Template:Team:Berkeley/topnav.js
From 2013.igem.org
(Difference between revisions)
(Created page with "var element = document.getElementById('navBar') window.addEventListener('scroll', function() { element.getBoundingClientRect().top < 0 ? element.classList.add('stuck')...") |
|||
Line 1: | Line 1: | ||
- | + | $(window).scroll(function () { | |
- | window. | + | if ($(window).scrollTop() > 100) { |
- | + | $('#main-nav').css('top', $(window).scrollTop()); | |
- | + | } | |
- | + | } | |
- | }); | + | ); |
Revision as of 20:17, 24 October 2013
$(window).scroll(function () {
if ($(window).scrollTop() > 100) { $('#main-nav').css('top', $(window).scrollTop()); }
} );