javascript - Nav isn't sticking to the top at widths less than 1025px -
i'm using wordpress , foundation build site. have nav bar i'd fix top of page once hits top of window. however, nav not sticking top @ widths smaller 1025px , i'm not getting console errors. here jquery:
jquery(document).ready(function($) { var distance = $('.maincontent').offset().top $(window).scroll(function() { if ($(window).scrolltop() >= distance) { $("#nav_bar").addclass("fixedtop"); } else { $("#nav_bar").removeclass("fixedtop"); } }) }); css
.fixedtop { position: fixed; top: 0; z-index: 999; margin-bottom: 30px; }
Comments
Post a Comment