From 1de00f9cd7be495195ea177c9c2515e708294f9b Mon Sep 17 00:00:00 2001 From: asolove Date: Sat, 26 Dec 2015 20:45:50 -0700 Subject: [PATCH] On page load, scroll sidebar to active section. --- src/theme/book.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/theme/book.js b/src/theme/book.js index 0754fee7..b07c9929 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -50,6 +50,13 @@ $( document ).ready(function() { }); + // Scroll sidebar to current active section + var activeSection = sidebar.find(".active"); + if(activeSection.length) { + sidebar.scrollTop(activeSection.offset().top); + } + + // Print button $("#print-button").click(function(){ var printWindow = window.open("print.html");