Team:SDU-Denmark/window

From 2012.igem.org

(Difference between revisions)
(Created page with "<script> $(function() { var $sidebar = $("#sidenav"), $window = $(window), offset = $sidebar.offset(), topPadding = 15; $window.scroll...")
 
Line 1: Line 1:
-
<script>
+
 
$(function() {
$(function() {
Line 20: Line 20:
      
      
});
});
-
</script>
 

Latest revision as of 11:52, 6 August 2012

$(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
           });
       }
   });
   

});