Team:DTU-Denmark/Templates/StartPage

From 2013.igem.org

(Difference between revisions)
 
(17 intermediate revisions not shown)
Line 28: Line 28:
     <!-- Navigation scroll follow -->
     <!-- Navigation scroll follow -->
     <script type="text/javascript">
     <script type="text/javascript">
-
         $(window).scroll(function () {  
+
        var prevScrollPos = -1000;
 +
         $(window).scroll(function () {
 +
           
 +
            <!-- here is added table of content fixing to screen : was all 35 with Title OutsideWhitebox-->
 +
            var scrollPos = Math.floor($(window).scrollTop());
 +
 
 +
            if(Math.abs(prevScrollPos - scrollPos) <= 1){
 +
                  return "nuthin";
 +
            }
 +
 
-
<!-- here is added table of content fixing to screen : was all 35 with Title OutsideWhitebox-->
 
-
            var scrollPos = $(window).scrollTop();
 
-
            var navigation_margin_from_top = 35;
 
             var toc_margin_from_top = $(".navigation").height() + 35;
             var toc_margin_from_top = $(".navigation").height() + 35;
             var scroll_pos_above_start_of_article = scrollPos < $(".whitebox.article").offset().top - 68;
             var scroll_pos_above_start_of_article = scrollPos < $(".whitebox.article").offset().top - 68;
             var toc_end_reached_bottom_of_article = scrollPos + toc_margin_from_top + $(".toc").height() > $(".whitebox.article").offset().top + $(".whitebox.article").height() - 35;
             var toc_end_reached_bottom_of_article = scrollPos + toc_margin_from_top + $(".toc").height() > $(".whitebox.article").offset().top + $(".whitebox.article").height() - 35;
             var toc_margin_from_title = scrollPos < ($(".whitebox.article").offset().top );
             var toc_margin_from_title = scrollPos < ($(".whitebox.article").offset().top );
 +
           
 +
             if(scroll_pos_above_start_of_article){
             if(scroll_pos_above_start_of_article){
Line 49: Line 57:
<!-- new attempt to fix menubar (jakob) -->
<!-- new attempt to fix menubar (jakob) -->
-
             if(scroll_pos_above_start_of_article){
+
            var scroll_pos_above_menubar = scrollPos < 250;
-
                   $(".navigation").offset({top: $(".whitebox.article").offset().top  + $(".navigation")[0].height() });
+
 
 +
             if(scroll_pos_above_menubar){
 +
                   $(".navigation").offset({top: 250 });
             } else {
             } else {
                   $(".navigation").offset({top: scrollPos});
                   $(".navigation").offset({top: scrollPos});

Latest revision as of 21:54, 4 October 2013