Change Div Positioning to Fixed at a Specific Scroll Point - Some code from mjnestor - Forrst


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $(window).scroll(function(){
  2.     if  ($(window).scrollTop() >= 229){ //looking for the window to scroll to 229px in this example
  3.          $('#navigation_table').css({position:'fixed',top:0,left:'50%',margin:'0 0 0 -487.5px'});
  4.     } else {
  5.          $('#navigation_table').css({position:'relative'});
  6.         }
  7. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.