Skip to content

Instantly share code, notes, and snippets.

@spullara
Created October 30, 2010 18:42
Show Gist options
  • Select an option

  • Save spullara/655611 to your computer and use it in GitHub Desktop.

Select an option

Save spullara/655611 to your computer and use it in GitHub Desktop.
/**
* Create a modal dialog box.
*/
;
(function($) {
$.fn.makeDialog = function () {
return this.each(function() {
var $dialog = $(this);
$dialog.hide().draggable().css('z-index', 3).bind('dlg-launch', null, function() {
var win = $(window);
$('body').prepend($('<div>&nbsp;</div>')
.css({position:'fixed', top:0, left: 0,
height: win.height(), width: win.width(),
display:'block', 'z-index': 2,
'background-color':'#FFFFFF', opacity: 0.5})
.attr('id', $dialog.attr('id') + "_mask"));
$dialog.center().show();
});
$dialog.bind('dlg-close', null, function() {
$('#' + $dialog.attr('id') + "_mask").remove();
$dialog.hide();
});
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment