UNPKG

1.69 kBJavaScriptView Raw
1/**
2 * lightgallery | 2.5.0 | June 13th 2022
3 * http://www.lightgalleryjs.com/
4 * Copyright (c) 2020 Sachin Neravath;
5 * @license GPLv3
6 */
7
8!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 o=function(){return(o=Object.assign||function(o){for(var t,e=1,i=arguments.length;e<i;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o}).apply(this,arguments)},t="lgBeforeOpen",e={margin:40,mediumZoom:!0,backgroundColor:"#000"};return function(){function i(t,i){var n=this;this.core=t,this.$LG=i,this.core.getMediaContainerPosition=function(){return{top:n.settings.margin,bottom:n.settings.margin}};var s={controls:!1,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=o(o({},this.core.settings),s),this.settings=o(o(o({},e),this.core.settings),s),this}return i.prototype.toggleItemClass=function(){for(var o=0;o<this.core.items.length;o++){this.$LG(this.core.items[o]).toggleClass("lg-medium-zoom-item")}},i.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()})))},i.prototype.destroy=function(){this.toggleItemClass()},i}()}));