Team:SDU-Denmark/window

From 2012.igem.org

Revision as of 11:47, 6 August 2012 by Asbiorn (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<script> $(function() {

   var $sidebar   = $("#sidenav"), 
       $window    = $(window),
       offset     = $sidebar.offset(),
       topPadding = 15;
   $window.scroll(function() {
       if ($window.scrollTop() > offset.top + 250 ) {
           $sidebar.stop().animate({
               marginTop: $window.scrollTop() - (offset.top + topPadding + 230	)
           });
       } else {
           $sidebar.stop().animate({
               marginTop: 0
           });
       }
   });
   

}); </script>