I\'m attempting to make the navigation bar stick to the top, when the user scrolls down to the nav bar and then unstick when the user scrolls back up past the navbar. I unde
window.addEventListener("scroll", function(evt) { var pos_top = document.body.scrollTop; if(pos_top == 0){ $('#divID').css('position','fixed'); } else if(pos_top > 0){ $('#divId').css('position','static'); } });