Hello everyone
first of all, i'd like to apologize for my probably very easy question. I'm no coder, i just wanted to custom my website and i got hooked with coding, one thing leading to another, i discovered gsap, i find the syntax pretty easy to understand, i'm more stuck with the triggering the timeline.
So i have 3 buttons each trigger a specific function.
when i press one button, i want to reverse any other function that played before playing this one .
So this code below works pretty well, but it is easy because i only have 3 different functions.
i was wondering if there was a better syntax : "reverse any function that my have played before" rather than listing them like this :
ingmvOpen.reverse();
nopackOpen.reverse();
$("#shipping-btn").click(function () {
if ($(this).hasClass("menu-open")) {
$(this).removeClass("menu-open");
shipOpen.reverse();
} else {
$(".slidein-btn").not( $(this) ).each(function(){
$(this).removeClass('menu-open');
ingmvOpen.reverse();
nopackOpen.reverse();
});
$(this).addClass("menu-open");
shipOpen.play();
}
});
and an optional question, i have to click on a button to reverse a timeline, how can reverse it by clicking anywhere on the page ?
thank you very for your patience
alex