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