-
Notifications
You must be signed in to change notification settings - Fork 4
/
dd_pushupbox.min.js
1 lines (1 loc) · 1.33 KB
/
dd_pushupbox.min.js
1
var DD_PushUpID,DD_PushUpContent,DD_PushUpClose,DD_PushUpBox=function(d,t,i){var n,u={width:320,padding:10,title:!0,closingX:!0,closingXHTML:"✖"};function o(t,i){var n=d("#dd_pub"),o=d("#dd_pub_title"),p=d("#dd_pub_content"),e=d("#dd_pub_overlay");o.html(i),p.html(t),e.show();var h=o.height()+p.height()+4*u.padding;n.css({width:u.width,height:"auto",margin:"-"+h/2+"px 0 0 -"+u.width/2+"px"}),n.css({margin:"-"+n.height()/2+"px 0 0 -"+u.width/2+"px"})}DD_PushUpID=function(t,i){DD_PushUpClose(),n=t;var u=d("#"+t);o(u.html(),i),u.html("")},DD_PushUpContent=function(d,t){DD_PushUpClose(),n=!1,o(d,t)},DD_PushUpClose=function(){d("#dd_pub_overlay").hide();var t=d("#dd_pub_content");n&&(d("#"+n).html(t.html()),n=!1),t.html("")};return{init:function(){var i="";u.title&&(i='<div id="dd_pub_title" style="padding: '+u.padding+'px"></div>');var n="";u.closingX&&(n='<button id="dd_pub_close">'+u.closingXHTML+"</button>"),d("body").append('<div id="dd_pub_overlay"><div id="dd_pub">'+n+i+'<div id="dd_pub_content" style="padding: '+u.padding+'px"></div></div></div>'),d("#dd_pub_close").on("click",function(){DD_PushUpClose()}),d(t).mouseup(function(t){var i=d("#dd_pub");i.is(t.target)||0!==i.has(t.target).length||DD_PushUpClose()}),d(t).keyup(function(d){27==d.keyCode&&DD_PushUpClose()})}}}(jQuery,document);jQuery(function(){DD_PushUpBox.init()});