BossBey File Manager
PHP:
8.2.30
OS:
Linux
User:
imagivibe
Root
/
home
/
imagivibe
/
www
/
CTR
/
wp-content
/
plugins
/
porto-functionality
/
shortcodes
/
assets
/
js
📤 Upload
📝 New File
📁 New Folder
Close
Editing: hz-scroller.min.js
(function(i,t){i=i||{};var e="__horizontalscroller",r=function(i,t){return this.initialize(i,t)};r.defaults={lg:3,md:1,init_refresh:!1},r.prototype={initialize:function(i,t){return i.data(e)||(this.$el=i,this.setData(t).build().event()),this},setData:function(i){return this.$el.data(e,this),this.options=t.extend(!0,{},r.defaults,i),this.$hScroller=this.$el.find(".horizontal-scroller"),this.$hScrollerItems=this.$hScroller.find(".horizontal-scroller-items"),this.$hScrollerItems.find(">*").addClass("horizontal-scroller-item"),this},build:function(){return this.originalScrollHTML=this.$hScroller.html(),this.scrollerInitialized=!1,this},generateScroller:function(){var i=gsap.utils.toArray(this.$hScrollerItems.find(".horizontal-scroller-item"));gsap.to(i,{xPercent:-100*(i.length-(t(window).width()>991?this.options.lg:this.options.md)),ease:"none",scrollTrigger:{trigger:".horizontal-scroller",pin:!0,scrub:1,snap:1/(i.length-1),end:()=>"+="+this.$hScrollerItems.width(),el:this.$el}}),this.scrollerInitialized=!0},event:function(){this.options.init_refresh&&this.generateScroller(),this.scrollFunc=this.scroll.bind(this),t(window).on("scroll",this.scrollFunc),this.afterResizeFunc=this.afterResize.bind(this),t(window).on("afterResize",this.afterResizeFunc)},scroll:function(){if(!this.scrollerInitialized){var i=this.$el[0].getBoundingClientRect();i.top>=0&&i.top<window.innerHeight&&i.bottom>=0&&this.generateScroller()}},afterResize:function(){this.scrollerInitialized=!1;for(var i=ScrollTrigger.getAll(),t=0;t<i.length;t++)if(i[t].vars&&void 0!==i[t].vars.el&&i[t].vars.el==this.$el){i[t].kill(!0),this.$el.empty().html('<div class="horizontal-scroller">'+this.originalScrollHTML+"</div>"),this.$hScrollerItems=this.$el.find(".horizontal-scroller-items");break}},clearData:function(){this.$el.removeData(e),t(window).off("scroll",this.scrollFunc),t(window).off("afterResize",this.afterResizeFunc)}},t.extend(i,{PluginHScroller:r}),t.fn.themePluginHScroller=function(i=!1){return"undefined"!=typeof gsap&&"undefined"!=typeof ScrollTrigger&&this.map((function(){var l=t(this);return l.data(e)?l.data(e):l.find(".horizontal-scroller-items>*").length?(options=l.data("plugin-hscroll"),i&&(options.init_refresh=!0),new r(l,options)):void 0}))}}).apply(this,[window.theme,jQuery]),jQuery(document).ready((function(i){i.fn.themePluginHScroller&&i(".horizontal-scroller-wrapper").each((function(){i(this).themePluginHScroller(!0)}))}));
Save
Cancel