1 line
1.5 KiB
JavaScript
Executable File
1 line
1.5 KiB
JavaScript
Executable File
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(o="undefined"!=typeof globalThis?globalThis:o||self).lgMediumZoom=t()}(this,function(){"use strict";var s=function(){return(s=Object.assign||function(o){for(var t,e=1,s=arguments.length;e<s;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(o[i]=t[i]);return o}).apply(this,arguments)},t="lgBeforeOpen",i={margin:40,mediumZoom:!0,backgroundColor:"#000"};function o(o,t){var e=this,o=(this.core=o,this.$LG=t,{controls:!(this.core.getMediaContainerPosition=function(){return{top:e.settings.margin,bottom:e.settings.margin}}),download:!1,counter:!1,showCloseIcon:!1,extraProps:["lgBackgroundColor"],closeOnTap:!1,enableSwipe:!1,enableDrag:!1,swipeToClose:!1,addClass:this.core.settings.addClass+" lg-medium-zoom"});return this.core.settings=s(s({},this.core.settings),o),this.settings=s(s(s({},i),this.core.settings),o),this}return o.prototype.toggleItemClass=function(){for(var o=0;o<this.core.items.length;o++)this.$LG(this.core.items[o]).toggleClass("lg-medium-zoom-item")},o.prototype.init=function(){var o=this;this.settings.mediumZoom&&(this.core.LGel.on(t+".medium",function(){o.core.$backdrop.css("background-color",o.core.galleryItems[o.core.index].lgBackgroundColor||o.settings.backgroundColor)}),this.toggleItemClass(),this.core.outer.on("click.lg.medium",function(){o.core.closeGallery()}))},o.prototype.destroy=function(){this.toggleItemClass()},o}); |