Hello,
A few months ago we've built a website with GSAP. The strange thing is, it just stopped working correctly. Animations will load when you resize the browser, ScrollSmoother stopped working whatever you do. When I view my project locally, everything works..
You can view the production version here; http://bitly.ws/BPNt
animation.js
// GSAP
import {gsap} from 'gsap';
import {ScrollTrigger} from 'gsap/ScrollTrigger';
import {ScrollSmoother} from 'gsap/ScrollSmoother';
import {SplitText} from 'gsap/SplitText';
gsap.registerPlugin(ScrollTrigger, ScrollSmoother, SplitText);
// jQuery
jQuery(function() {
// ScrollSmoother
let smoother = ScrollSmoother.create({
smooth: 2,
effects: true
});
// Split Text
if(document.querySelector('.js-split-text')) {
var childSplit = new SplitText('.js-split-text', {
type: 'lines',
linesClass: 'inline-block'
});
var parentSplit = new SplitText('.js-split-text', {
type: 'lines',
linesClass: 'overflow-hidden'
});
gsap.set(childSplit.lines, {opacity: 0});
ScrollTrigger.batch(childSplit.lines, {
onEnter: batch => {
gsap.set(batch, {
opacity: 1,
yPercent: 100
});
gsap.to(batch, {
yPercent: 0,
duration: 1.5,
ease: 'power4',
stagger: 0.3
});
},
start: 'bottom 95%',
once: true
});
}
// Reveal Image
if(document.querySelector('.js-reveal-img')) {
let revealContainers = document.querySelectorAll('.js-reveal-img');
revealContainers.forEach((container) => {
let image = container.querySelector('img');
let tl = gsap.timeline({
scrollTrigger: {
trigger: container,
once: true
}
});
tl.set(container, { autoAlpha: 1 });
tl.from(container, 1.5, {
xPercent: -100,
ease: 'power2.inOut'
});
tl.from(image, 1.5, {
xPercent: 100,
scale: 1.3,
delay: -1.5,
ease: 'power2.inOut'
});
});
}
// Items Fade
if(document.querySelector('.js-items-fade')) {
$('.js-items-fade').each(function (index) {
let triggerElement = $(this);
let tl = gsap.timeline({
scrollTrigger: {
trigger: triggerElement,
start: '0% 100%',
end: '100% 0%',
}
});
tl.from('.js-items-fade .js-item', {
y: '2em',
opacity: 0,
stagger: .2,
duration: 1,
ease: 'power3.inOut',
delay: '.2'
}, 0);
});
}
});
Dependencies;
"@alpinejs/collapse": "^3.10.2",
"@barba/core": "^2.9.7",
"@gsap/shockingly": "^3.10.4",
"@roots/bud": "5.8.7",
"@roots/bud-postcss": "^5.8.7",
"@roots/bud-sass": "^5.8.7",
"@roots/bud-tailwindcss": "5.8.7",
"@roots/sage": "5.8.7",
"@tailwindcss/typography": "^0.5.2",
"alpinejs": "^3.10.2",
"flickity": "^3.0.0",
"gsap": "npm:@gsap/shockingly",
"js-cookie": "^3.0.1"
Any help would be appreciated!
Thanks