flim Posted October 18, 2021 Share Posted October 18, 2021 Is that ScrollTrigger.refresh() only effect on ScrollTrigger.create() instances? But not on scrollTrigger inside gasp.to? Link to comment Share on other sites More sharing options...
Solution akapowl Posted October 18, 2021 Solution Share Posted October 18, 2021 Hello @flim That's quite testable - short answer: it does aso work on scrollTrigger inside a gsap.to() Click the body to change the height of the .bg in this following example and see how the markers adjust because of the .refresh() that is being called. See the Pen 16cfd8e6cedfd6ef69c32da5664e1895 by akapowl (@akapowl) on CodePen 1 1 Link to comment Share on other sites More sharing options...
flim Posted October 19, 2021 Author Share Posted October 19, 2021 I want to set the scroller-start position calculated by the height of header. See the Pen gOxrmKP by fredlim (@fredlim) on CodePen I am newbie in JS and GSAP, many thanks for your help Link to comment Share on other sites More sharing options...
OSUblake Posted October 19, 2021 Share Posted October 19, 2021 Hi flim! You just need to add invalidateOnRefresh: true to your ScrollTrigger, and put the calculation inside the start function. ScrollTrigger will fire that function on refresh so you don't have to add resize listeners. See the Pen PoKzoJy by GreenSock (@GreenSock) on CodePen 2 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