Here is my code example for menu anchors
gsap.utils.toArray('.navigation-link').forEach(function (nav, i) {
nav.addEventListener('click', (e) => {
const id = e.target.getAttribute('href');
gsap.to(window, {duration: 1, scrollTo:{y: `${id}`, offsetY:0}});
e.preventDefault();
});
});
It works perfectly! But my sections are pined (look code above)
gsap.utils.toArray('.overscroll').forEach((section, i) => {
ScrollTrigger.create({
trigger: section,
start: "bottom bottom",
pin: true,
pinSpacing: false,
});
});
So, when i click forward, for example, from second nav link to fifth it works perfectly! But if I click backward (from 4 nav link to 2 nav link) it took me to wrong section position(((
When I disable pin: true it started work perfectly, but for my project I need these feature
PS Is is vertical scroll
Plz help?