window.__STYLEGALLERY_ASSETS__={}; gsap.registerPlugin(ScrollTrigger, ScrollSmoother); const smoother = ScrollSmoother.create({ wrapper: "#smooth-wrapper", content: "#smooth-content", smooth: 2, normalizeScroll: true, ignoreMobileResize: true, preventDefault: true }); if (document.getElementById("portfolio")) { const horizontalSections = gsap.utils.toArray(".horiz-gallery-wrapper"); horizontalSections.forEach(function(sec, i) { const pinWrap = sec.querySelector(".horiz-gallery-strip"); let pinWrapWidth; let horizontalScrollLength; function refresh() { pinWrapWidth = pinWrap.scrollWidth; horizontalScrollLength = pinWrapWidth - window.innerWidth; } refresh(); gsap.to(pinWrap, { scrollTrigger: { scrub: true, trigger: sec, pin: sec, start: "center center", end: () => `+=${pinWrapWidth}`, invalidateOnRefresh: true }, x: () => -horizontalScrollLength, ease: "none" }); ScrollTrigger.addEventListener("refreshInit", refresh); }); } addEventListener("load", () => requestAnimationFrame(() => { ScrollTrigger.refresh(); const gallery = ScrollTrigger.getAll().find((item) => item.trigger?.matches(".horiz-gallery-wrapper")); if (gallery) { smoother.scrollTop(gallery.start + (gallery.end - gallery.start) * 0.12); ScrollTrigger.update(); } }));