Created
October 7, 2012 21:37
-
-
Save tsubik/3849685 to your computer and use it in GitHub Desktop.
Simple jQueryUI DialogManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(w){ | |
var DialogManager = (function(){ | |
function DialogManager(){ | |
this.dialogIdx= 1; | |
}; | |
DialogManager.prototype.createDialog = function(options){ | |
var defaults = { | |
modal: true, | |
resizeable: false, | |
autoOpen: false, | |
//removing dialog after close | |
close: function () { | |
$(this).remove(); | |
} | |
}; | |
var id = 'dialogId' + this.dialogIdx; | |
$box = $('#' + id); | |
if (!$box.length) { | |
$box = $('<div id="' + id + '"></div>').hide().appendTo('body'); | |
this.dialogIdx++; | |
} | |
$box.dialog($.extend({}, defaults, options)); | |
return $box; | |
}; | |
return DialogManager; | |
})(); | |
w.DialogManager = new DialogManager; | |
})(window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dialog = DialogManager.createDialog({minWidth: 400, title: 'Set some title'}); | |
dialog.html('Here is the content'); | |
dialog.dialog('open'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment