Difference between revisions of "Template:Team:TU Darmstadt/MainMenu"

Line 142: Line 142:
 
console.log(this);
 
console.log(this);
 
console.log(window.location.href);
 
console.log(window.location.href);
 +
    }
 +
  });
 +
});
 +
</script>
 +
 +
<script>
 +
$(window).load(function() {
 +
  var distance = $('#title').outerHeight() + $('#top_menu_under').outerHeight(),
 +
  $window = $(window);
 +
  console.log(distance);
 +
 
 +
  $window.scroll(function() {
 +
    if ( $window.scrollTop() >= distance ) {
 +
      $('.navbar').addClass('top-fixed');
 +
      console.log('on top');
 +
    } else if ( $window.scrollTop() <= distance && $('.navbar').hasClass('top-fixed') ) {
 +
      $('.navbar').removeClass('top-fixed');
 
     }
 
     }
 
   });
 
   });

Revision as of 11:18, 13 October 2016