like you im no coder either, it took me a while to figure it out. The issue is that the proper coders or front-end developers create packages and bundle javascript files like locomotive inside it.
For my example, I inherited an existing bundle someone else had made which I made. I don’t know how to use tools like NPM to make bundles.
You have to reference the Locomotive CSS file as well as the following javascript files
locomotive-scroll.min.js
gsap.min.js
ScrollTrigger.min.js
I’m assuming you do understand how to access the and of each HTML page in Webflow? All the information you need is in the custom section of home.html in my demo.
As you can see from the sample code, my parent div has class named “.smooth-scroll”. The locomotive javascript needs to know where to start the scrolling from therefore in the code:
const locoScroll = new LocomotiveScroll({
el: document.querySelector(“.smooth-scroll”),
smooth: true
});
You will see “.smooth-scroll” being passed through. Then ScrollTrigger uses the same parent class too.
The code is simple to follow through which was taken from Snorkl TV . If you go through his example, he explains what is happening. Snorkl has a lot of great videos on learning GSAP. Even I am still learning and making mistakes. It is a hard but makes you appreciate more what others have done.
Good to hear. So did you implement it with GSAP & Locomotive Scroll? If so then I am afraid that is my limit of GSAP. It is something you will need to investigate further on your own.
I can confirm this works with sticky elements if you follow it slowly step by step. You only need to name your classes correctly and add custom code to the page settings. A link to the CSS-file in the head tag, and the rest “before body tag”.
So I guess, chances are good, swup will work here. If there are any issues which I won’t be able to resolve, I will dig some in barba js to achieve what I have in mind.
Still prefer css transitions over js ones.