Hi All,
As you can see in the Codepen demo that the hamburger menu is working fine if user clicks on the menu icon. However, what I am looking is to close the burger menu with the same reverse animation if user clicks on any of the hyperlinks before proceeding to the nextpage/link. Can anyone please let me know how to do it?
menu test (codepen.io)
$('.hamburger').on("click", function(e){
$('.hamburger.active').not(this).removeClass('active');
$(this).toggleClass('active');
});
var $hamburger = $('.hamburger');
gsap.set('.line01',{x:40});
gsap.set('.line03',{x:-40});
//gsap.set('.navigation',{xPercent:-50, yPercent:-50})
gsap.set('.navigation li',{x:0, opacity:0});
var hamburgerMotion = gsap.timeline();
hamburgerMotion.to('.line03',0.4,{x:'-=40'},0)
hamburgerMotion.to('.line01',0.4,{x:'+=40'},0)
hamburgerMotion.to('.menu',0.4,{autoAlpha:1},0)
hamburgerMotion.staggerTo('.navigation li',0.4,{y:-30, opacity:1, ease: "sine.out"},0.2,0.5)
//hamburgerMotion.to('.navigation li',1,{marginBottom:'40px', ease: Power1.easeOut})
hamburgerMotion.from('.getintouch',.8,{y:30, opacity:0, ease: "sine.out"})
hamburgerMotion.reverse();
$hamburger.on('click', function(e) {
hamburgerMotion.reversed(!hamburgerMotion.reversed());
});
$('.menu-links').on("mouseover", function (e){
gsap.to($(this), .4, {x:20, ease: "sine.out"});
})
$('.menu-links').on("mouseout", function (e){
gsap.to($(this), .4, {x:0, ease: "sine.out"});
})
$(".hamburger").on("click", function (e) {
if ($(this).hasClass("active")) {
$(".cursor-follower").addClass("reverse");
}
else {
$(".cursor-follower").removeClass("reverse");
}
});