Beatles BOB
Beatles BOB

Reputation: 343

Gsap ScrollTrigger : Make my section translate on scroll

I'm trying to remake scroll effect from this website : https://wemakefab.com/

gsap.registerPlugin(ScrollTrigger);
gsap.to(".scroll-content",{
    scrollTrigger:{
        trigger:".scroll-content",
        start:'top top',
        end:'bottom bottom',
        scrub:1.2,
        markers:true
    },
    y:-document.querySelector('.scroll-content').offsetHeight
})

It actually translate on scroll but it also create some huge white space at the end of the website. On the exemple they are putting css overflow:hidden on body but for me it block completly the scroll.

<div class="scroll-content">
            <section class="green"></section>
            <section class="blue"></section>
            <section class="green"></section>
            <section class="blue"></section>
            <section class="green"></section>
            <section class="blue"></section>
            <section class="green"></section>
            <section class="blue"></section>
            <section class="green"></section>
            <section class="blue"></section>
        </div>

Upvotes: 1

Views: 1494

Answers (1)

Beatles BOB
Beatles BOB

Reputation: 343

To fix this, I finally put a container around the scroll-content with an height of 100vh and it's all seems to work like a charm

Upvotes: 0

Related Questions