(This page includes affiliate links. If you click and purchase, I receive a small commission at no extra cost from you and that way you can support me. I only recommend tools that I have personally used and loved.)
Get Elementor Pro Today –
1 – Elementor Pro
Change Direction of Marquee based on Scroll up or Scroll down
With the below code, you can create a marquee with any element and simply change the direction based on scroll up or down. We use CSS, Javascript(JS) and mainly GSAP to achieve this.
Research
Design
Deploy
Success
Research
Design
Deploy
Success
Research
Design
Deploy
Success
Research
Design
Deploy
Success
- We add the script src code to run GSAP library on our page. This needs to be added only once in a page so make sure not to have copies of it and also make sure no other plugin/theme has added GSAP to your website.
- We add transition:none to our elements that are controlled by GSAP. This is needed in Elementor only as by default Elementor adds transition:all to all elements. As we are controlling our element with GSAP, we don’t use transition CSS property.
- The code for white-space:nowrap has been commented out as it may or may not be needed. Simply remove comments if you need it as in some cases it will help to keep the content in same line.
- .marquee-container is parent container that contains .marquee-inner two times. Please refer above video to match with your project.
- We also use overflow-x:clip to remove horizontal scrolling from overflowing of content. We use overflow-x:clip instead of overflow-x:hidden; as for some reason, it is not working in elementor.
- .animated-gradient is the class of container which parents .marquee-container.