]> BookStack Code Mirror - bookstack/commitdiff
Fixes #45 60/head
authorNick Walke <redacted>
Thu, 11 Feb 2016 18:15:16 +0000 (12:15 -0600)
committerNick Walke <redacted>
Thu, 11 Feb 2016 20:02:17 +0000 (14:02 -0600)
resources/assets/js/pages/page-show.js

index c125289756091f150ac75e83c9def812aa432128..59938bbbc526bebf4252189644f97ac7959a6b26 100644 (file)
@@ -72,4 +72,19 @@ window.setupPageShow = module.exports = function (pageId) {
         goToText(text);
     }
 
-};
\ No newline at end of file
+    // Get current tree's width
+    var bookTreeWidth = $(".book-tree").width();
+    // Get header height
+    var headerHeight = $("#header").height() + $(".faded-small").height();
+    $(window).scroll(function () {
+      if($(window).scrollTop() > headerHeight){
+        // Begin to scroll
+        $(".book-tree").width(bookTreeWidth);
+        $(".book-tree").css("position", "fixed");
+        $(".book-tree").css("top", 0);
+      } else {
+        // Lock it back in place
+        $(".book-tree").css("position", "relative");
+      }
+    })
+};