Sacha Posted March 28, 2022 Share Posted March 28, 2022 Hey, I'm having problems killing / deactivating a scrolltrigger after it got activated. My goal is to play a html video at a specific point with the scrolltrigger. After the video got started once, the scrolltrigger should be removed. I tried finding something in the docs but could only find the ScrollTrigger.kill() function, which kills all ScrollTriggers or how to kill a timeline. Is it possible to only kill certain triggers, for example using an ID or something similar without using a whole timeline? const video = document.querySelector("video"); ScrollTrigger.create({ trigger: video, start: "bottom bottom", markers: true, id: i, onToggle: () => video.play() + ScrollTrigger.kill(), toggleActions: 'play none none none', }); Link to comment Share on other sites More sharing options...
Solution akapowl Posted March 28, 2022 Solution Share Posted March 28, 2022 Hello Sacha, You can pass self to callback functions and target it(self) this way. See the Pen BaJRxVP by akapowl (@akapowl) on CodePen Or you can use ScrollTrigger.getById() to target a ScrollTigger with a specific ID. See the Pen PoEmeWE by akapowl (@akapowl) on CodePen 1 1 Link to comment Share on other sites More sharing options...
Sacha Posted March 28, 2022 Author Share Posted March 28, 2022 Thank you a lot! Solved my problem 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