E
E
enerjze2019-02-05 16:38:43
css
enerjze, 2019-02-05 16:38:43

How to close the modal menu when clicking on an anchor?

Hello everyone, the problem is the following: on the mobile version of the menu in the form of a modal window, when you click on the menu, the active class is hung up, but when you click on the category (anchor), the menu does not close.

function initMenu()
  {
    if($('.menu').length)
    {
      var menu = $('.menu');
      hamburger.on('click', function()
      {
        hamburger.toggleClass('active');
        menu.toggleClass('active');
      });
    }
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FeST1Val, 2019-02-05
@FeST1Val

Add a class to menu items and when clicking on them, remove the active class from menu.
I would also add a click on the dark part to close the menu

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question