Share Posted November 11, 2021 Hello, I have an issue that I haven't been able to fix. I have a scrolltrigger moving some pinned images right to left and the final images has to stay close to the edge of the screen. The issue is when there is a resize it seems that the scrolltrigger just breaks and I don't know exactly how to handle the resize. I try to kill the tween and created again but it does nothing. Edit. It looks like the codepen is not working, don't know why. I had to open it and then click run to make it work. See the Pen porZXXr by godhandkiller (@godhandkiller) on CodePen Link to comment Share on other sites More sharing options...
Solution Solution Share Posted November 11, 2021 17 minutes ago, hmontelongo said: Edit. It looks like the codepen is not working, don't know why. I had to open it and then click run to make it work. You are using export, which won't work in a normal CodePen. You don't need to listen for resizes as ScrollTrigger does that automatically. For values that are dynamically calculated, you should use function based values. this.timeline = gsap.timeline(scrollTrigger:{ trigger: this.$slidesContainer, start: 'top+=80px top+=350px', end: () => '+=' + $(this.$slides[0]).width() * this.$slides.length, scrub: 0.1, invalidateOnRefresh: true }) .to(this.$slides, { x: () => { let slideWidth = $(this.$slides[0]).width() let slidesWidth = slideWidth * this.$slides.length return -(slidesWidth + 380) }, ease: 'none' }) 1 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