Skip to content

Commit

Permalink
fix scroll issue (rust-lang#1108)
Browse files Browse the repository at this point in the history
* fix sidebar scrolling

* fix query selector
  • Loading branch information
arash-hacker authored and Dylan-DPC committed Dec 2, 2019
1 parent d8b077f commit 3165ae2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/theme/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ function playpen_text(playpen) {
(function sidebar() {
var html = document.querySelector("html");
var sidebar = document.getElementById("sidebar");
var sidebarScrollBox = document.getElementById("sidebar-scrollbox");
var sidebarScrollBox = document.querySelector(".sidebar-scrollbox");
var sidebarLinks = document.querySelectorAll('#sidebar a');
var sidebarToggleButton = document.getElementById("sidebar-toggle");
var sidebarResizeHandle = document.getElementById("sidebar-resize-handle");
Expand Down Expand Up @@ -505,7 +505,7 @@ function playpen_text(playpen) {
}, { passive: true });

// Scroll sidebar to current active section
var activeSection = sidebar.querySelector(".active");
var activeSection = document.getElementById("sidebar").querySelector(".active");
if (activeSection) {
sidebarScrollBox.scrollTop = activeSection.offsetTop;
}
Expand Down

0 comments on commit 3165ae2

Please sign in to comment.