I am currently working on implementing a responsive navigation. The goal is to add a class when the width of the element exceeds a certain value, and remove that class when it falls below that value:
var navWidth = $("#primary-header-nav").width();
if (navWidth < 770) {
$('#primary-header-nav li a').addClass('box-1-9');
} else {
$('#primary-header-nav li a').removeClass('box-1-9');
}
Unfortunately, despite the conditional logic in place, the class is never actually applied - regardless of the width.
If you'd like to take a look at the actual website where this issue is occurring, here is the link: