Template:Team:Berkeley/scrollspyOffset.js
From 2013.igem.org
(Difference between revisions)
Line 6: | Line 6: | ||
$('.navbar li a').click(function (event) { | $('.navbar li a').click(function (event) { | ||
- | var scrollPos = $(' | + | var scrollPos = $('html').find($(this).attr('href')).offset().top - offsetHeight; |
$('body,html').animate({ | $('body,html').animate({ | ||
scrollTop: scrollPos | scrollTop: scrollPos |
Revision as of 16:29, 28 October 2013
var offsetHeight = 331;
$('.nav-collapse').scrollspy({
offset: offsetHeight
});
$('.navbar li a').click(function (event) {
var scrollPos = $('html').find($(this).attr('href')).offset().top - offsetHeight; $('body,html').animate({ scrollTop: scrollPos }, 1000); return false;
});