I need to do what would normally be a horizontal menu on the desktop, and on mobile devices there was a leaving menu, a button. Wrote the code

$('.menu__but').click(function () { $('.menu__ul').stop(); $('.menu__ul').slideToggle(); }); 

but when the button triggers the slideToggle function and hides the menu, then the menu is not visible in the desktop, of course, because display:none now. Wrote such code

 if (window.matchMedia('(min-width: 761px)').matches) { $('.menu__ul').css({ display:'block' }); } 

But he did not help me. How to be?

  • one
    the same thing happens. Take squeeze the browser window, close the menu, and without opening it, maximize the browser window. The menu has disappeared, I actually have the same problem. - Alexander Alekseev
  • present understand, will work on it - user33274
  • and by the way, if it's not difficult to see how it works from a mobile phone , otherwise you will not believe me: geyanpeaple.imtqy.com/menu - user33274
  • Mobile phone works fine. But still the menu disappears. Essentially not correct = ( - Alexander Alekseev

0