From: Nick Walke Date: Thu, 11 Feb 2016 18:15:16 +0000 (-0600) Subject: Fixes #45 X-Git-Tag: v0.7.4~1^2~1 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/refs/pull/60/head?ds=inline Fixes #45 --- diff --git a/resources/assets/js/pages/page-show.js b/resources/assets/js/pages/page-show.js index c12528975..59938bbbc 100644 --- a/resources/assets/js/pages/page-show.js +++ b/resources/assets/js/pages/page-show.js @@ -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"); + } + }) +};