The following function replaces alert() messages with jQuery modal messages. How can I easily change the width and dialogClass or not call parent.$.fancybox.close(); in specific instances?
- window.old_alert = window.alert;
- window.alert = function(message, fallback){
- if(fallback)
- {
- old_alert(message);
- return;
- }
- $(document.createElement('div'))
- .attr({title: 'Alert', 'class': 'alert'})
- .html(message)
- .dialog({
- buttons: {OK: function(){$(this).dialog('close');}},
- close: function(){$(this).remove();
- parent.$.fancybox.close();},
- draggable: false,
- modal: true,
- resizable: false,
- dialogClass: "alert_message",
- width: '400'
- });
- $(".ui-dialog-titlebar").hide();
- };