Solution momo12 Posted September 19, 2022 Solution Share Posted September 19, 2022 Sorry guys, I have a few gsap.timelines(); I want to animate something when user clicks on a button for the first time (It will use A as GSAP.timeline()) and if user clicks on a button for the second time (It will use B as GSAP.timeline()). The problem I have is what should I do if user clicks continously? Third and fourth and ...! I use this code but doesn't work for some reasons! var clicks = 0; $(".m-btn").click(function() { if (clicks % 2 == 0) { tl.play("spin"); } else { tl.play("spinn"); } clicks++; }); Found the problem! Added GSAP a few times caused the issue Link to comment Share on other sites More sharing options...
Rodrigo Posted September 20, 2022 Share Posted September 20, 2022 Hi @momo12 I assume that you were able to solve the issue, right? 1 Link to comment Share on other sites More sharing options...
momo12 Posted September 20, 2022 Author Share Posted September 20, 2022 7 hours ago, Rodrigo said: Hi @momo12 I assume that you were able to solve the issue, right? Yes. I added two script tags of GSAP and it seems caused an issue. Thanks! 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