Kargi-Sitesi/assets/js/lightbox.min.js

1 line
1.6 KiB
JavaScript
Raw Permalink Normal View History

2024-11-04 02:53:42 +00:00
!function(a){a.extend(a.fn,{simpleLightboxVideo:function(){var b={delayAnimation:300,keyCodeClose:27};a.simpleLightboxVideo.vars=a.extend({},b);var c=this;return c.click(function(){if(window.innerHeight>540)var b=(window.innerHeight-540)/2;else var b=0;var c='<iframe src="" width="640" height="480" id="slvj-video-embed" style="border:0;"></iframe>',d='<div id="slvj-close-icon"></div>',e='<div class="slvj-lightbox" style="margin-top:'+b+'px">',f='<div id="slvj-back-lightbox">',g='<div id="slvj-background-close"></div>',h='<div id="slvj-window">',i="</div></div></div>";if(a("body").append(h+g+f+e+d+c+i),a("#slvj-window").hide(),"youtube"==a(this).data("videosite"))var j="http://www.youtube.com/embed/"+a(this).data("videoid")+"?autoplay=1";else if("vimeo"==a(this).data("videosite"))var j="http://player.vimeo.com/video/"+a(this).data("videoid")+"?autoplay=1";return a("#slvj-window").fadeIn(),a("#slvj-video-embed").attr("src",j),a("#slvj-close-icon").click(function(){a("#slvj-window").fadeOut(a.simpleLightboxVideo.vars.delayAnimation,function(){a(this).remove()})}),a("#slvj-background-close").click(function(){a("#slvj-window").fadeOut(a.simpleLightboxVideo.vars.delayAnimation,function(){a(this).remove()})}),!1}),a(document).keyup(function(b){27==b.keyCode&&a("#slvj-window").fadeOut(a.simpleLightboxVideo.vars.delayAnimation,function(){a(this).remove()})}),a(window).resize(function(){if(window.innerHeight>540)var b=(window.innerHeight-540)/2;else var b=0;a(".slvj-lightbox").css({marginTop:b+"px"})}),!1}})}(jQuery),function(a){a.simpleLightboxVideo=function(b,c){return a(c).simpleLightboxVideo()}}(jQuery);