So I have a responsive navigation menu. a button is used to toggle the menu in and out. This is working fine.
I added an exception, where if the window exceeds a certain width, the menu closes, however this is not working at all. I can't find what is wrong with this code.
JS:
$(document).ready(function(){
$(".menubutton").click(function(){
$(".respmenu-gen").toggleClass("respmenu-opn respmenu-cls");
});
if ($(window).width() > 767) {
$(".respmenu-gen").removeClass("respmenu-opn").addClass("respmenu-cls")
};
});
jsfiddle: https://jsfiddle.net/76amgsb8/
Thank you!