Share Posted September 12, 2020 Had a trawl through the site and codepen but couldn't find an answer. I have timelines that require different scrolltrigger values according to media queries, is it correct to place paused timelines outside the ScrollTrigger.matchMedia() and the scrolltrigger/s inside the function? Or is it best practice to duplicate timelines in each media query? Or some other setup? Thanks See the Pen QWNrJRr by brodiero (@brodiero) on CodePen Link to comment Share on other sites More sharing options...
Share Posted September 14, 2020 There isn't a hard-and-fast rule about this, but I'd personally find it more readable/maintainable to put stuff inside the matchMedia() object. Remember that it'll keep track of the ScrollTriggers that are created inside that function and kill those (along with their attached animation) when the media query no longer matches. Let us know if you run into any problems. 🙌 1 1 Link to comment Share on other sites More sharing options...
Author Share Posted September 14, 2020 Thanks Jack, it's good to know it's acceptable, if not recommended 😉 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