venizia03 Posted August 11, 2020 Share Posted August 11, 2020 (edited) Hello! When one of my animation runs (the sidebar menu is opening), I want to add a class name to the body tag. I use: menuTl = gsap.timeline({paused: true}); menuTl.set('body', { className: '+=menu-open' }); But this does remove any existing classes. Is there something I miss? Thx! Edited August 11, 2020 by venizia03 Indicate this has been solved Link to comment Share on other sites More sharing options...
ZachSaucier Posted August 11, 2020 Share Posted August 11, 2020 Hey venizia03. className tweens were removed from GSAP 3. For situations like this we recommend using the .classList API: document.body.classList.add('menu-open'); 1 Link to comment Share on other sites More sharing options...
venizia03 Posted August 11, 2020 Author Share Posted August 11, 2020 Thx! I will change my code right away! 😁😁 Link to comment Share on other sites More sharing options...
Talha Meer Posted August 4, 2022 Share Posted August 4, 2022 I am facing the same issue, when I add the class to the element the class is add, but animation don't work. gsap.to(document.querySelectorAll(".prev i.animation"), { keyframes: [ { duration: 0.2, x: -5, }, { duration: 0.5, x: -3, }, { duration: 0.2, x: -5, }, { duration: 0.5, x: 0, }, ], }); Link to comment Share on other sites More sharing options...
Cassie Posted August 4, 2022 Share Posted August 4, 2022 Hi there, Can you please start a new thread with a minimal demo. Thank you! 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