I need assistance with my responsive navigation bar. I am having trouble with the jQuery code to disable hover events if the width is less than or equal to 768px and enable it for desktop screens.
$(window).on('load resize', function (e) {
var w = $(window).width();
if (w <= 768) {
$('nav').css({ display: "none" })
$('#last').off('mouseenter mouseleave mouseover mouseout');
}
if (w > 768) {
$('nav').css({ display: "block" })
$('#last').on('mouseenter mouseleave mouseover mouseout', function() { });
}
});
I'm not sure what's causing an issue in this code. Can someone help me out?