fix scroll issue (#1108)

* fix sidebar scrolling

* fix query selector
This commit is contained in:
Arashmidos 2019-12-02 13:37:24 +03:30 committed by Dylan DPC
parent e3717ad47b
commit 6a94492238
1 changed files with 2 additions and 2 deletions

View File

@ -408,7 +408,7 @@ function playpen_text(playpen) {
(function sidebar() { (function sidebar() {
var html = document.querySelector("html"); var html = document.querySelector("html");
var sidebar = document.getElementById("sidebar"); var sidebar = document.getElementById("sidebar");
var sidebarScrollBox = document.getElementById("sidebar-scrollbox"); var sidebarScrollBox = document.querySelector(".sidebar-scrollbox");
var sidebarLinks = document.querySelectorAll('#sidebar a'); var sidebarLinks = document.querySelectorAll('#sidebar a');
var sidebarToggleButton = document.getElementById("sidebar-toggle"); var sidebarToggleButton = document.getElementById("sidebar-toggle");
var sidebarResizeHandle = document.getElementById("sidebar-resize-handle"); var sidebarResizeHandle = document.getElementById("sidebar-resize-handle");
@ -505,7 +505,7 @@ function playpen_text(playpen) {
}, { passive: true }); }, { passive: true });
// Scroll sidebar to current active section // Scroll sidebar to current active section
var activeSection = sidebar.querySelector(".active"); var activeSection = document.getElementById("sidebar").querySelector(".active");
if (activeSection) { if (activeSection) {
sidebarScrollBox.scrollTop = activeSection.offsetTop; sidebarScrollBox.scrollTop = activeSection.offsetTop;
} }