I’ve currently got this jQuery to prepend a div if the window is a certain size.
if ( $(window).width() < 480) {
$('nav').css("display","none");
$('#container').prepend('<div id="nav-btn"></div>');
}
How do I get this to ‘continually’ check and hide the <div id="nav-btn"></div> when the browser is being resized?
EDIT: I want it so that when the window width then reaches 481px the <nav> element is set to display:block; and the #nav-btn is hidden. But dynamically so it all works on resize after resize, not just once.
The following achieves your requirements (so far as I can tell):
JS Fiddle demo.
References:
appendTo().text().trigger().