Pixizz85 Posted April 15, 2022 Share Posted April 15, 2022 Hello everyone, I'm having trouble finalizing my accordion component (based on this example : codepen.io/GreenSock/pen/QWMRxGX) Works fine but I can't manage to finalize it. I want the first item to be expanded when we arrive on the page as on my first test version below (without GSAP, just CSS with some javascript): See the Pen OJzaPPV by nero85 (@nero85) on CodePen Many thanks in advance for your help Jérôme See the Pen QWaJwbG by nero85 (@nero85) on CodePen Link to comment Share on other sites More sharing options...
Solution PointC Posted April 15, 2022 Solution Share Posted April 15, 2022 I think you'd just want to fire your toggleAnimation for the first (or any) target. toggleAnimation(menus[0]) See the Pen 8c41c65452d55975167840c9e0daef37 by PointC (@PointC) on CodePen Hopefully that helps. Happy tweening. 4 Link to comment Share on other sites More sharing options...
Pixizz85 Posted April 15, 2022 Author Share Posted April 15, 2022 Thank you so much Craig it helps me a lot ! I keep learning... Now I'll go on and try to do a different tween when the element closes. Maybe I'll come back soon... 😅 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