-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.reveal.min.js
1 lines (1 loc) · 2.44 KB
/
jquery.reveal.min.js
1
jQuery(document).ready(function(a){a(document).on("click","a[data-reveal-id]",function(c){c.preventDefault();var b=a(this).attr("data-reveal-id");a("#"+b).reveal(a(this).data())});a.fn.reveal=function(b){var c={animation:"none",animationSpeed:300,closeOnBackgroundClick:true,dismissModalClass:"close-reveal-modal"};var b=a.extend({},c,b);return this.each(function(){var n=a(this),g=parseInt(n.css("top")),i=n.height()+g,h=false,e=a(".reveal-modal-bg");var m=a(window).height();var o=n.outerHeight();var l;if(e.length==0){e=a('<div class="reveal-modal-bg" />').insertAfter(n);e.fadeTo("fast",0.8)}function k(){e.unbind("click.modalEvent");a("."+b.dismissModalClass).unbind("click.modalEvent");if(!h){q();if(b.animation=="fadeAndPop"){n.css({top:a(document).scrollTop()-i,opacity:0,visibility:"visible",display:"block"});e.fadeIn(b.animationSpeed/2);n.delay(b.animationSpeed/2).animate({top:a(document).scrollTop()+g+"px",opacity:1},b.animationSpeed,j)}if(b.animation=="fade"){n.css({opacity:0,visibility:"visible",display:"block",top:a(document).scrollTop()+g});e.fadeIn(b.animationSpeed/2);n.delay(b.animationSpeed/2).animate({opacity:1},b.animationSpeed,j)}if(b.animation=="none"){if(o>m){l=parseInt(Math.min(100,m/10),10)}else{l=parseInt((m-o)/4,10)+g}n.css({visibility:"visible",display:"block",top:l+"px"});e.css({display:"block"});j()}}n.unbind("reveal:open",k)}n.bind("reveal:open",k);function f(){if(!h){q();if(b.animation=="fadeAndPop"){e.delay(b.animationSpeed).fadeOut(b.animationSpeed);n.animate({top:a(document).scrollTop()-i+"px",opacity:0},b.animationSpeed/2,function(){n.css({top:g,opacity:1,visibility:"hidden",display:"none"});j()})}if(b.animation=="fade"){e.delay(b.animationSpeed).fadeOut(b.animationSpeed);n.animate({opacity:0},b.animationSpeed,function(){n.css({opacity:1,visibility:"hidden",display:"none",top:g});j()})}if(b.animation=="none"){n.css({visibility:"hidden",display:"none",top:g});e.css({display:"none"})}p()}n.unbind("reveal:close",f)}n.bind("reveal:close",f);n.trigger("reveal:open");var d=a("."+b.dismissModalClass).bind("click.modalEvent",function(){n.trigger("reveal:close")});if(b.closeOnBackgroundClick){e.css({cursor:"pointer"});e.bind("click.modalEvent",function(){n.trigger("reveal:close")})}a("body").keyup(function(r){if(r.which===27){n.trigger("reveal:close")}});function j(){h=false}function q(){h=true}function p(){var s=a("iframe",n);if(s.length>0){var r=s.attr("src");s.attr("src","");s.attr("src",r.replace("autoplay=1","autoplay=0"))}}})}});