fullscreen.min.js
1.45 KB
N2Require("SmartSliderWidgetFullScreenImage",[],[],function(t,e,i){function s(e,i,s,o){this.slider=window[e],this.slider.started(t.proxy(this.start,this,e,i,s,o))}return s.prototype.start=function(e,i,s,o){return this.slider.sliderElement.data("fullscreen")?!1:(this.responsive=this.slider.responsive,this.slider.sliderElement.data("fullscreen",this).on({n2FullScreen:t.proxy(function(){this.button.addClass("n2-active")},this),n2ExitFullScreen:t.proxy(function(){this.button.removeClass("n2-active")},this)}),this.button=this.slider.sliderElement.find(".n2-full-screen-widget"),this.deferred=t.Deferred(),this.slider.sliderElement.on("SliderDevice",t.proxy(this.onDevice,this)).trigger("addWidget",this.deferred),this.button.on("click",t.proxy(this.slider.controlFullscreen.switchState,this.slider.controlFullscreen)),this.desktopRatio=i,this.tabletRatio=s,this.mobileRatio=o,void this.button.n2imagesLoaded().always(t.proxy(this.loaded,this)))},s.prototype.loaded=function(){this.button.css("display","inline-block"),this.width=this.button.width(),this.height=this.button.height(),this.button.css("display",""),this.onDevice(null,{device:this.responsive.getDeviceMode()}),this.deferred.resolve()},s.prototype.onDevice=function(t,e){var i=1;switch(e.device){case"tablet":i=this.tabletRatio;break;case"mobile":i=this.mobileRatio;break;default:i=this.desktopRatio}this.button.width(this.width*i),this.button.height(this.height*i)},s.prototype.destroy=function(){this.button.remove()},s});