Showing
1 changed file
with
15 additions
and
0 deletions
| ... | @@ -72,4 +72,19 @@ window.setupPageShow = module.exports = function (pageId) { | ... | @@ -72,4 +72,19 @@ window.setupPageShow = module.exports = function (pageId) { |
| 72 | goToText(text); | 72 | goToText(text); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | + // Get current tree's width | ||
| 76 | + var bookTreeWidth = $(".book-tree").width(); | ||
| 77 | + // Get header height | ||
| 78 | + var headerHeight = $("#header").height() + $(".faded-small").height(); | ||
| 79 | + $(window).scroll(function () { | ||
| 80 | + if($(window).scrollTop() > headerHeight){ | ||
| 81 | + // Begin to scroll | ||
| 82 | + $(".book-tree").width(bookTreeWidth); | ||
| 83 | + $(".book-tree").css("position", "fixed"); | ||
| 84 | + $(".book-tree").css("top", 0); | ||
| 85 | + } else { | ||
| 86 | + // Lock it back in place | ||
| 87 | + $(".book-tree").css("position", "relative"); | ||
| 88 | + } | ||
| 89 | + }) | ||
| 75 | }; | 90 | }; | ... | ... |
-
Please register or sign in to post a comment