Jamesh Posted August 6, 2020 Share Posted August 6, 2020 I have a portfolio which can be filtered. The animation I have is a reveal which works fine when viewing all the items (and using the filter), as ScrollTrigger is able to work out the position of each of the items. However, when the items are filtered, and one of the items which has not come into the viewport is activated, the transition fails to trigger. I'm assuming that this is because ScrollTrigger has already assigned its position in the initially loaded page. Is there a way of refreshing the position of an element after it has been filtered? I have tried onRefresh but have failed so far. Thanks James See the Pen NWNWQLm by jame5 (@jame5) on CodePen Link to comment Share on other sites More sharing options...
akapowl Posted August 6, 2020 Share Posted August 6, 2020 Hey @Jamesh. If I understood correctly, what you basically want, is to refresh ScrollTrigger after the sorting/filtering animation is done? you could simply just call ScrollTrigger.refresh(); whenever you need to. I threw it into one of your functions there with a delayed-call just to make a quick pen: See the Pen bcaf6fbd9073eb9747f2b1200a0b4df0 by akapowl (@akapowl) on CodePen Is this what you are after? Cheers, Paul 2 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