Team:DTU-Denmark/Templates/StartPage
From 2013.igem.org
(Difference between revisions)
Line 30: | Line 30: | ||
$(window).scroll(function () { | $(window).scroll(function () { | ||
var scrollPos = $(window).scrollTop(); | var scrollPos = $(window).scrollTop(); | ||
- | if (scrollPos > | + | if (scrollPos > 240) { <!-- was 110 -jakob, we need to remeasure the heigth of our top banner --> |
$(".navigation").addClass("stickToTop"); | $(".navigation").addClass("stickToTop"); | ||
} else { | } else { | ||
Line 37: | Line 37: | ||
<!-- here is added table of content fixing to screen --> | <!-- here is added table of content fixing to screen --> | ||
- | var toc_margin_from_top = $(".navigation").height() + | + | var toc_margin_from_top = $(".navigation").height() + 45; |
- | var scroll_pos_above_start_of_article = scrollPos < $(".whitebox.article").offset().top - | + | var scroll_pos_above_start_of_article = scrollPos < $(".whitebox.article").offset().top - 45; |
- | var toc_end_reached_bottom_of_article = scrollPos + toc_margin_from_top + $(".toc").height() > $(".whitebox.article").offset().top + $(".whitebox.article").height() - | + | var toc_end_reached_bottom_of_article = scrollPos + toc_margin_from_top + $(".toc").height() > $(".whitebox.article").offset().top + $(".whitebox.article").height() - 45; |
if(scroll_pos_above_start_of_article){ | if(scroll_pos_above_start_of_article){ | ||
- | $(".toc").offset({top: $(".whitebox.article").offset().top + | + | $(".toc").offset({top: $(".whitebox.article").offset().top + 45}); |
} else if(toc_end_reached_bottom_of_article){ | } else if(toc_end_reached_bottom_of_article){ | ||
- | $(".toc").offset({top: $(".whitebox.article").offset().top + $(".whitebox.article").height() - $(".toc").height() - | + | $(".toc").offset({top: $(".whitebox.article").offset().top + $(".whitebox.article").height() - $(".toc").height() - 45}); |
} else { | } else { | ||
$(".toc").offset({top: scrollPos + toc_margin_from_top}); | $(".toc").offset({top: scrollPos + toc_margin_from_top}); |
Revision as of 08:11, 27 August 2013