$(document).ready(function(){ $('#toggle-nav').click(function(e){ e.preventDefault(); $('#responsive-nav').slideToggle('fast'); }); }); $( window ).resize(function() { if(!$('#toggle-nav').is(":visible")){ $('#responsive-nav').css('display','block'); } else $('#responsive-nav').css('display','none'); });