-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmodalPopLite.min.js
1 lines (1 loc) · 1.97 KB
/
modalPopLite.min.js
1
(function(e){var t=0;e.fn.modalPopLite=function(n){var n=e.extend({},{openButton:"modalPopLite-open-btn",closeButton:"modalPopLite-close-btn",isModal:false,callBack:null},n);return this.each(function(){t++;var r=t;var i=false;var s=e(this);var o=n.openButton;var u=n.closeButton;var a=n.isModal;s.before('<div id="modalPopLite-mask'+r+'" style="width:100%" class="modalPopLite-mask" />');s.wrap('<div id="modalPopLite-wrapper'+r+'" style="left: -10000px;" class="modalPopLite-wrapper" />');s.addClass("modalPopLite-child-"+r);e(o).on("click",function(t){t.preventDefault();var n=e(window).width();var s=e(window).height();var o=e(".modalPopLite-child-"+r).outerWidth();var u=e(".modalPopLite-child-"+r).outerHeight();var a=n/2-o/2;var f=s/2-u/2;e("#modalPopLite-mask"+r).css("height",s+"px");e("#modalPopLite-mask"+r).fadeTo("slow",.6);e("#modalPopLite-wrapper"+r).css({left:a+"px",top:f});e("#modalPopLite-wrapper"+r).fadeIn("slow");i=true});e(u).on("click",function(t){t.preventDefault();e("#modalPopLite-mask"+r).hide();e("#modalPopLite-wrapper"+r).css("left","-10000px");i=false;if(n.callBack!=null){n.callBack.call(this)}});if(!a){e("#modalPopLite-mask"+r).click(function(t){t.preventDefault();e(this).hide();e("#modalPopLite-wrapper"+r).css("left","-10000px");i=false;if(n.callBack!=null){n.callBack.call(this)}})}e(window).resize(function(){if(i){var t=e(window).width();var n=e(window).height();var s=e(".modalPopLite-child-"+r).outerWidth();var o=e(".modalPopLite-child-"+r).outerHeight();var u=t/2-s/2;var a=n/2-o/2;e("#modalPopLite-wrapper"+r).css({left:u+"px",top:a});e("#modalPopLite-mask"+r).css("height",n+"px")}})})};e.fn.modalPopLite.Close=function(t){e("#modalPopLite-mask"+t).hide();e("#modalPopLite-wrapper"+thisPopID).css("left","-10000px");if(options.callBack!=null){options.callBack.call(this)}};e.fn.modalPopLite.ShowProgress=function(){e('<div class="popBox-ajax-progress"></div>').appendTo("body")};e.fn.modalPopLite.HideProgress=function(){e(".popBox-ajax-progress").remove()}})(jQuery)