Home>

I'm trying to implement full screen navigation by copying jQuery from this site.

That's fine, but it takes me to the anchor link on the same page, but the fullscreen navigation doesn't close.
(If i make the background of full screen navigation translucent, you can see that it is moving)
How can it be closed?
Thanks for your answer

jQuery (function ($) {
    $('.menu'). on ('click', function () {
        $('.menu__line'). ToggleClass ('active');
        $('.gnav'). fadeToggle ();
    });
});
  • Answer # 1

    You can also add a click event to the link element.
    jQuery is a selector,You can specify multiple elements separated by.

    $('.menu, .gnav__menu__item a'). on ('click', function () {
        $('.menu__line'). ToggleClass ('active');
        $('.gnav'). fadeToggle ();
    });