Template:Team:Berkeley/sidenav.js
From 2013.igem.org
(Difference between revisions)
Line 8: | Line 8: | ||
} | } | ||
); | ); | ||
+ | |||
+ | |||
+ | var offset = 80; | ||
+ | |||
+ | $('.navbar li a').click(function(event) { | ||
+ | event.preventDefault(); | ||
+ | $($(this).attr('href'))[0].scrollIntoView(); | ||
+ | scrollBy(0, -offset); | ||
+ | }); |
Revision as of 16:56, 25 October 2013
$(window).scroll(function () {
if ($(window).scrollLeft() > 0) { $('#navbar').css('left', -($(window).scrollLeft()) + 50); } else { $('#navbar').css('left', 50); }
} );
var offset = 80;
$('.navbar li a').click(function(event) {
event.preventDefault(); $($(this).attr('href'))[0].scrollIntoView(); scrollBy(0, -offset);
});