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