First of all Thank you ,
Let me explain it better what i am confused about.
(look at the new codepen)
if box 1 is clicked it will go right and box 1 content will be visible, and if box2 is clicked the box 2 content will be visible,
so the variables are the box classes , and only box is visible at one time . So a function passes the variable to be worked on.
in the below codepen,
-each box has content hidden underneath
-on respective box clicks it reveals the content and hides it when clicked again
- not disabled the other boxclick while one is revealing the content (for the this codepen purpose only, in my case i am disabling that)
now the reverse button doesnt work as intended by me, but its working as it should (which i dont want), and so looking for a better solution
as i am re-declaring the timeline on each click( which is the main issue, i want to pass a dynamic variable but that only can be done if the timeline is inside a function callback as otherwise it will be declared at the time of page load).
so if we use the restart and reverse(0) in JS ( which is commented by me , right now in codepen) then it works as intended, but which i believe is not the right way of doing things (according to your previous replies)
what i want is as following (if you un-comment the JS code in codepen you will get the result which i am going for)
1. reverse should animate back to where we started
2. only respective clicked box should have its play and reverse animation
thank you again , looking forward to a better solution to this ?