V
V
Valentina2018-01-30 20:47:31
Bootstrap
Valentina, 2018-01-30 20:47:31

How to make the menu in the mobile version close when you click on an item from the menu?

Single page site on Wordpress. There is a standard menu. Fixed and not scrolling. Links are seen as anchors on the same page.
Here is the site gosur.com.ua
In the mobile version, it has the following behavior:
Click on the "sandwich" menu.
The menu opens.
Click on any link.
The page scrolls to the anchor.
BUT the menu does not close =((((

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Teploukhov, 2018-01-30
@blood-moon

Perhaps a fierce crutch, but maybe so

$('.menu-list').click(function(){ // по нажатию на элемент в меню
$(".navbar-toggle").addClass("collapsed") //  бургер
$(".navbar-collapse-1").removeClass("in") //  меню
});

T
tyzberd, 2018-01-30
@tyzberd

var menu = jQuery('.theme-main-menu');
var burger = menu.find('.navbar-toggle');
menu.find('.menu-item a').on('click', function(){
    if(!burger.hasClass('collapsed')){
        burger.trigger('click');
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question