Hey there,
i have build a website with lots of scroll trigger animation. unveils, split text, pinned sections etc.
i just started cross browser testing and noticed that on chrome(mac) when i scroll down a page and then reload, lots of stuff breaks:
- pinned sections are misplaced
- the scroll position of the page itself changes on reload
- other effects stop working completely
I can't really put together a codepen for this, because when you reload a codepen the result always starts with scrolposition top.
Has anybody ever experienced something like this?
Is this a common problem with chrome?
Am I doing something completely wrong?
Any help much appreciated.
Here is the footer part that contains all animation script:
<script src="<?php echo get_stylesheet_directory_uri(); ?>/src/gsap/gsap.min.js"></script>
<script src="<?php echo get_stylesheet_directory_uri(); ?>/src/gsap/ScrollTrigger.min.js"></script>
<script>
/* navpoint */
$('.navpoint2').addClass('activenavpoint');
/* logo color */
var headerLogo = document.querySelector('.headerlogo');
var hueValue = Math.floor(Math.random() * 360);
headerLogo.style.filter = 'hue-rotate(' + hueValue + 'deg)';
/* register gsap */
gsap.registerPlugin(ScrollTrigger);
/* unveil classes */
let unveilfade1 = gsap.utils.toArray(".unveilfade1");
unveilfade1.forEach((uvf1, i) => {
gsap.from(uvf1, {
autoAlpha: 0,
ease: "power1.out",
duration: 2,
scrollTrigger: {
trigger: uvf1,
start: "top 90%",
end: "top 90%",
}
});
});
let unveilfade2 = gsap.utils.toArray(".unveilfade2");
unveilfade2.forEach((uvf2, i) => {
gsap.from(uvf2, {
autoAlpha: 0,
ease: "power1.out",
duration: 2,
delay: 0.3,
scrollTrigger: {
trigger: uvf2,
start: "top 90%",
end: "top 90%",
}
});
});
let unveilfade3 = gsap.utils.toArray(".unveilfade3");
unveilfade3.forEach((uvf3, i) => {
gsap.from(uvf3, {
autoAlpha: 0,
ease: "power1.out",
duration: 2,
delay: 0.6,
scrollTrigger: {
trigger: uvf3,
start: "top 90%",
end: "top 90%",
}
});
});
/* pinned panel */
gsap.utils.toArray(".panel").forEach((panel, i) => {
ScrollTrigger.create({
trigger: panel,
start: "top top",
pin: true,
pinSpacing: false,
markers: true
});
});
</script>