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?