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);
| |
- | });
| |
- |
| |
- |
| |
- |
| |
- |
| |
- |
| |
- |
| |
- |
| |
- | var offsetHeight = 551;
| |
- | var scrollPos = $('body > .container').find($(this).attr('href')).offset().top - (offsetHeight - 1);
| |
- |
| |
- | $('body').scrollspy({
| |
- | offset: offsetHeight
| |
- | });
| |
- |
| |
- | $('.nav-collapse').scrollspy({
| |
- | offset: offsetHeight
| |
- | });
| |
- |
| |
- | $('.navbar li a').click(function (event) {
| |
- | var scrollPos = $('body > .container').find($(this).attr('href')).offset().top - offsetHeight;
| |
- | $('body,html').animate({
| |
- | scrollTop: scrollPos
| |
- | }, 500, function () {
| |
- | $(".btn-navbar").click();
| |
- | });
| |
- | return false;
| |
- | });
| |
Latest revision as of 01:39, 28 October 2013
$(window).scroll(function () {
if ($(window).scrollTop() > 289) {
$('#main-nav').css('top', $(window).scrollTop() - 289);
}
else {
$('#main-nav').css('top', 0);
}
}
);