Klyuk88 Posted July 29, 2021 Share Posted July 29, 2021 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 More sharing options...
Cassie Posted July 29, 2021 Share Posted July 29, 2021 Hey there @Klyuk88! We can usually help more effectively if you provide a minimal demo, codepen is great for this. It's quite hard to debug without the relevant markup and styles included. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now