﻿(function(n){var t={init:function(t){return t=n.extend({top:"auto",autoOpen:!1,overlayOpacity:.5,overlayColor:"#000",overlayClose:!0,closeOnEscape:!0,closeButtonClass:".close",onOpen:!1,onClose:!1},t),this.each(function(){var i=t,u=n('<div class="lean-overlay"><\/div>'),r;u.css({display:"none",position:"fixed","z-index":2e3,top:0,left:0,height:"100%",width:"100%",background:i.overlayColor,opacity:i.overlayOpacity}).appendTo("body"),r=n(this),r.css({display:"none",position:"fixed","z-index":2001,left:"50%",top:parseInt(i.top)>-1?i.top+"px":"50%","margin-left":-(r.outerWidth()/2)+"px","margin-top":(parseInt(i.top)>-1?0:-(r.outerHeight()/2))+"px"}),r.bind("openModal",function(){n(this).css("display","block"),u.fadeIn(200,function(){if(i.onOpen&&typeof i.onOpen=="function")i.onOpen(r[0])})}),r.bind("closeModal",function(){n(this).css("display","none"),u.fadeOut(200,function(){if(i.onClose&&typeof i.onClose=="function")i.onClose(r[0])})}),u.click(function(){i.overlayClose&&r.trigger("closeModal")}),n(document).keydown(function(n){i.closeOnEscape&&n.keyCode==27&&r.trigger("closeModal")}),r.find(i.closeButtonClass).click(function(n){r.trigger("closeModal"),n.preventDefault()}),i.autoOpen&&r.trigger("openModal")})}};n.fn.easyModal=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist on jQuery.easyModal");else return t.init.apply(this,arguments)}})(jQuery);
﻿(function(b){var a={init:function(c){var d={top:"auto",autoOpen:false,overlayOpacity:0.5,overlayColor:"#000",overlayClose:true,overlayParent:"body",closeOnEscape:true,closeButtonClass:".close",onOpen:false,onClose:false};c=b.extend(d,c);return this.each(function(){var g=c;var e=b('<div class="lean-overlay"></div>');e.css({display:"none",position:"fixed","z-index":2000,top:0,left:0,height:100+"%",width:100+"%",background:g.overlayColor,opacity:g.overlayOpacity}).appendTo(g.overlayParent);var f=b(this);f.css({display:"none",position:"fixed","z-index":2001,left:50+"%",top:parseInt(g.top)>-1?g.top+"px":50+"%","margin-left":-(f.outerWidth()/2)+"px","margin-top":(parseInt(g.top)>-1?0:-(f.outerHeight()/2))+"px"});f.bind("openModal",function(h){b(this).css("display","block");e.fadeIn(200,function(){if(g.onOpen&&typeof(g.onOpen)==="function"){g.onOpen(f[0])}})});f.bind("closeModal",function(h){b(this).css("display","none");e.fadeOut(200,function(){if(g.onClose&&typeof(g.onClose)==="function"){g.onClose(f[0])}})});e.click(function(){if(g.overlayClose){f.trigger("closeModal")}});b(document).keydown(function(h){if(g.closeOnEscape&&h.keyCode==27){f.trigger("closeModal")}});f.find(g.closeButtonClass).click(function(h){f.trigger("closeModal");h.preventDefault()});if(g.autoOpen){f.trigger("openModal")}})}};b.fn.easyModal=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.easyModal")}}}})(jQuery);
Update minified version