Hello,
I am using ScrollTrigger to move a fixed nav out of the view with the footer. I think the mechanism here is not as important as the problem is more about using variables for the trigger positions.
I get the vertical height of my nav first and then use its value for the trigger positioning.
The problem is, the nav will change height depending on its own state (toggled/expanded).
Is there a way I can update the variable vheight?
let box = document.querySelector('#nav');
let vheight = box.offsetHeight;
gsap.registerPlugin(ScrollTrigger);
gsap.to("#nav", {
scrollTrigger: {
trigger: "#footer",
start: "0 " + vheight,
end: vheight + " " + vheight,
scrub: 0,
// id: "nav-out",
// markers: true,
},
translateY: "-" + vheight,
ease: "none",
});
Thanks a lot!