Team:DTU-Denmark/Templates/StartPage

From 2013.igem.org

(Difference between revisions)
m
m
Line 37: Line 37:
<!-- here is added table of content fixing to screen -->
<!-- here is added table of content fixing to screen -->
-
                var scroll_pos_below_start_of_article = scrollPos > 310;
+
            var scroll_pos_below_start_of_article = scrollPos > 310;
-
                var toc_end_reached_bottom_of_article = $(".toc").offset().top + $(".toc").height() < $(".whitebox.article").offset().top + $(".whitebox.article").height();
+
            var toc_end_reached_bottom_of_article = $(".toc").offset().top + $(".toc").height() < $(".whitebox.article").offset().top + $(".whitebox.article").height();
-
             if (scroll_pos_below_start_of_article){ //&& (scrollPos < $(document).height() - $(".navigation")[0].height() - 70)) {
+
             if(scroll_pos_below_start_of_article){
-
                $(".toc").addClass("stickBelowNavigation");
+
                  $(".toc").offset().top = $(".whitebox.article").offset().top + 10;
 +
            } else if(toc_end_reached_bottom_of_article){
 +
                  $(".toc").offset().top = $(".whitebox.article").offset().top + $(".whitebox.article").height() - $(".toc").height() - 10;
             } else {
             } else {
-
                $(".toc").removeClass("stickBelowNavigation");
+
                  $(".toc").offset().top = scrollPos + 10;
             }
             }
 +
 +
 +
            //if (scroll_pos_below_start_of_article){ //&& (scrollPos < $(document).height() - $(".navigation")[0].height() - 70)) {
 +
            //    $(".toc").addClass("stickBelowNavigation");
 +
            //} else {
 +
            //  $(".toc").removeClass("stickBelowNavigation");
 +
            //}
         });
         });
     </script>
     </script>

Revision as of 14:20, 22 July 2013

{{{1}}}