Template:Team:DukeMenu/CSS

From 2014.igem.org

(Difference between revisions)
Line 67: Line 67:
</div>
</div>
 +
<script>
 +
$(document).ready(function() {
 +
  //change the integers below to match the height of your upper dive, which I called
 +
  //banner.  Just add a 1 to the last number.  console.log($(window).scrollTop())
 +
  //to figure out what the scroll position is when exactly you want to fix the nav
 +
  //bar or div or whatever.  I stuck in the console.log for you.  Just remove when
 +
  //you know the position.
 +
  $(window).scroll(function () {
 +
 +
    console.log($(window).scrollTop());
 +
 +
    if ($(window).scrollTop() > 550) {
 +
      $('#menu').addClass('fixed');
 +
    }
 +
 +
    if ($(window).scrollTop() < 551) {
 +
      $('#menu').removeClass('fixed');
 +
    }
 +
  });
 +
});
 +
</script>
</body>
</body>
</html>
</html>

Revision as of 21:11, 24 July 2014