Jquery, Remove class when width screen is 1050px
css, javascript, jquery
Solution
To change `html` to `#menu2`, just replace one with the other. jQuery is pretty simple in this respect
if ($(window).width() < 514) {
$('#menu2').addClass('f-nav');
} else {
$('#menu2').removeClass('f-nav');
}
JSFiddle
Problem
This is the JS code i'm using: ``` $("document").ready(function($){ var nav = $('#menu2'); $(window).scroll(function () { if ($(this).scrollTop() > 90) { nav.addClass("f-nav"); } else { nav.removeClass("f-nav"); } }); ``` But i can't seem to get this into my code. ``` function checkWidth(init){ /*If browser resized, check width again */ if ($(window).width() < 514) { $('html').addClass('mobile'); } else { if (!init) { $('html').removeClass('mobile'); }}}$(document).ready(function() { checkWidth(true); $(window).resize(function() { checkWidth(false); }); ``` And what i want is that when `.f-nav` is added to `#menu2`, when the screen is `<1050` the classshould be removed.