Jump to content
Search Community

tycondrious

Members
  • Posts

    1
  • Joined

  • Last visited

tycondrious's Achievements

  1. I'm using the vertical smooth scrolling feature, but it's not working on mobile, can you provide support? this code gsap.registerPlugin(ScrollTrigger); gsap.registerPlugin(ScrollToPlugin); let sections = gsap.utils.toArray(".panel"); function goToSection(i) { gsap.to(window, { scrollTo: { y: i * window.innerHeight, autoKill: false, ease: "power3.inOut" }, duration: 0.5 }); } sections.forEach((eachPanel, i) => { ScrollTrigger.create({ trigger: eachPanel, start: "top center", end: "bottom center", onEnter: () => goToSection(i), onEnterBack: () => goToSection(i) }); }); window.addEventListener("wheel", function(event) { if (event.deltaY > 0) { scrollDown(); } else { scrollUp(); } }); function scrollDown() { let currentSection = Math.floor(window.scrollY / window.innerHeight); goToSection(currentSection + 1); } function scrollUp() { let currentSection = Math.floor(window.scrollY / window.innerHeight); goToSection(currentSection - 1); }
×
×
  • Create New...