Andy1708 Posted July 20, 2020 Share Posted July 20, 2020 I have one question with this greensock's pen (link). why using "gsap.utils.toArray(".comparisonSection").forEach(section => {}...." if you have only one section ? it could perfectly work without and with the trigger set to : .comparisonSection thanks for your answer Andy See the Pen oNjgEjm by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted July 20, 2020 Share Posted July 20, 2020 25 minutes ago, Andy1708 said: why using "gsap.utils.toArray(".comparisonSection").forEach(section => {}...." if you have only one section ? it could perfectly work without and with the trigger set to : .comparisonSection thanks for your answer Hey Andy. I created it in this way in case someone added more similar sections later on It doesn't add much to the code to support multiple instances and it's good to show how it could be done (even before people ask). Not having to modify the code later if you wanted to add support for multiple instances is also a plus. 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