Jump to content
Search Community

Jump when using scrolltrigger in google chrome

Klyuk88 test
Moderator Tag

Recommended Posts

Sometimes, when scrolling the page, the block with the command jumps. What could be the problem? Help please.

Recording screen

Page with bug

 

    if (window.innerWidth >= 1200) {
        try {
            function scrollTeam() {
                const teamWrap = document.querySelector('.team-wrap');
                const teamSec = document.querySelector('.team');
                const containerWidth = document.querySelector('.team-sec').clientWidth;
                const teamWrapWidth = teamWrap.clientWidth;


                if (teamSec && (teamWrapWidth > containerWidth)) {
                    const viewPartOfTeamWrap = teamWrapWidth - containerWidth;

                    let tl = gsap.timeline({
                        scrollTrigger: {
                            trigger: teamSec,
                            start: 'top top',
                            scrub: 1,
                            anticipatePin: 1,
                            pin: true
                        }
                    })


                    tl.to(teamWrap, {
                        x: -(viewPartOfTeamWrap + 30)
                    })
                }
            }
            scrollTeam()

        } catch (error) {
            console.log(error);

        }
    }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...