Sorry no codepen but everything is working fine except that when navigating to a new page. If you hit refresh it's all good or even just resizing the window a tad. There is an element with bottom -252px and it's positioned fine except that the start | end now appear 252px from the bottom.
I've got the following code:
mounted() {
gsap.registerPlugin(ScrollTrigger);
this.headingAnimation();
},
beforeDestroy() {
ScrollTrigger.getAll().forEach(t => t.kill());
},
methods: {
headingAnimation() {
for (let i = 0; i < this.boxes.length; i++) {
gsap.to(this.$refs.opacityChange[i], {
opacity: 0.5,
scrollTrigger: {
trigger: `.content-${i}`,
start: 'top bottom',
end: 'top bottom-=200',
scrub: true,
invalidateOnRefresh: true,
markers: true,
},
});
Please let me know if there's another step for Nuxt. Thanks!