-
Notifications
You must be signed in to change notification settings - Fork 354
/
jquery.avgrund.min.js
2 lines (2 loc) · 1.95 KB
/
jquery.avgrund.min.js
1
2
/*! jquery.avgrund - v1.3.3 (http://labs.voronianski.com/jquery.avgrund.js) */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function($){$.fn.avgrund=function(a){var b={width:380,height:280,showClose:!1,showCloseText:"",closeByEscape:!0,closeByDocument:!0,holderClass:"",overlayClass:"",enableStackAnimation:!1,onBlurContainer:"",openOnEvent:!0,setEvent:"click",onLoad:!1,onUnload:!1,onClosing:!1,template:"<p>This is test popin content!</p>"};return a=$.extend(b,a),this.each(function(){function b(b){a.closeByEscape&&27===b.keyCode&&e()}function c(b){a.closeByDocument?$(b.target).is(".avgrund-overlay, .avgrund-close")&&(b.preventDefault(),e()):$(b.target).is(".avgrund-close")&&(b.preventDefault(),e())}function d(){"function"==typeof a.onLoad&&a.onLoad(f),setTimeout(function(){g.addClass("avgrund-active")},100);var d=$('<div class="avgrund-popin '+a.holderClass+'"></div>');d.append(j),g.append(d),$(".avgrund-popin").css({width:h+"px",height:i+"px","margin-left":"-"+(h/2+10)+"px","margin-top":"-"+(i/2+10)+"px"}),a.showClose&&$(".avgrund-popin").append('<a href="#" class="avgrund-close">'+a.showCloseText+"</a>"),a.enableStackAnimation&&$(".avgrund-popin").addClass("stack"),g.bind("keyup",b).bind("click",c)}function e(){return"function"!=typeof a.onClosing||a.onClosing(f)?(g.unbind("keyup",b).unbind("click",c).removeClass("avgrund-active"),setTimeout(function(){$(".avgrund-popin").remove()},500),"function"==typeof a.onUnload&&a.onUnload(f),void 0):!1}var f=$(this),g=$("body"),h=a.width>640?640:a.width,i=a.height>350?350:a.height,j="function"==typeof a.template?a.template(f):a.template;g.addClass("avgrund-ready"),0===$(".avgrund-overlay").length&&g.append('<div class="avgrund-overlay '+a.overlayClass+'"></div>'),""!==a.onBlurContainer&&$(a.onBlurContainer).addClass("avgrund-blur"),a.openOnEvent?f.bind(a.setEvent,function(a){a.stopPropagation(),$(a.target).is("a")&&a.preventDefault(),d()}):d()})}});