Team:DTU-Denmark-2/Header

From 2011.igem.org

(Difference between revisions)
Line 237: Line 237:
<br>
<br>
-
<div id="EndOfPage"></div>
 
-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" charset="utf-8"></script>
 
-
<script type="text/javascript" charset="utf-8">
 
-
$(function(){
 
-
//  $('#test').text($(this).scrollTop());
 
-
  var menu = $('#menu')
 
-
  var pos = menu.position().top;
 
-
  var offset = 20;
 
-
  $(window).scroll(function(){
 
-
    $('#test').text(menu.position().top);
 
-
    if(($(this).scrollTop() + menu.height() + offset) > $('#EndOfPage').position().top) {
 
-
      menu.css("position", "absolute");
 
-
      menu.css("top", ($('#EndOfPage').position().top - menu.height()) + "px");
 
-
    }else{
 
-
 
-
      if(($(this).scrollTop() + offset) > pos) {
 
-
        menu.css("position", "fixed");
 
-
        menu.css("top", offset + "px");
 
-
      }else{
 
-
        menu.css("position", "relative");
 
-
        menu.css("top", "0px");
 
-
      }
 
-
    }
 
-
 
-
 
-
  });
 
-
});
 
-
</script>
 
</head>
</head>
</html>
</html>

Revision as of 13:51, 2 September 2011