1
I would like to add a class when the viewport
is less than 899px
and remove when the viewport
is greater than that.
At first my code worked,
but without removing the class when the viewport
increases.
$(window).resize(function () {
var viewportWidth = $(window).width();
if (viewportWidth < 800) {
document.querySelector('.layout-fixed-header').classList.add("layout-small-menu");
}
});
What would be the best way to assemble this code?