Files
postshop-backend/public/web/shella/scripts/section.gallery.min.js
2026-02-03 15:31:29 +05:00

1 line
1.2 KiB
JavaScript

theme.Gallery=function(){function e(e){this.$container=$(e),this.namespace=".gallery",this.onLoad()}return e.prototype=$.extend({},Section.prototype,e.prototype,{onLoad:function(){theme.is_loaded&&(theme.ImagesLazyLoad.update(),theme.Masonry&&theme.Masonry.init(!0));var e=$(".gallery"),t=e.find(".gallery__fotorama"),a=t.fotorama({thumbmargin:0,thumbborderwidth:0}).data("fotorama");t.addClass("d-none-important"),this.fotorama=a,$(".fotorama__arr--prev").append($("<i>").append(theme.Global.getIcon("006"))),$(".fotorama__arr--next").append($("<i>").append(theme.Global.getIcon("007"))),$(".fotorama__fullscreen-icon").append($("<i>").append(theme.Global.getIcon("164"))),e.on("click",".gallery__item",function(){var e=$(this).attr("data-index"),o=Math.max($html.scrollTop(),$body.scrollTop());a.show({index:e,time:0}),t.removeClass("d-none-important invisible position-absolute"),a.requestFullScreen(),$html.scrollTop(o)}),t.on("fotorama:fullscreenexit",function(){t.addClass("d-none-important invisible position-absolute")})},onUnload:function(){this.$container.off(this.namespace),theme.Masonry&&theme.Masonry.destroy(),this.fotorama&&(this.fotorama.destroy(),this.fotorama=null)}}),e}(),$(function(){theme.sections.register("gallery",theme.Gallery)});