From d700f05c90ec35c7743b714e566fc6a30db2de99 Mon Sep 17 00:00:00 2001 From: Amie Chen Date: Mon, 15 Jan 2018 09:46:09 -0800 Subject: [PATCH] improve the code of the smoothscrolling on the doc page --- scribbler.js | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/scribbler.js b/scribbler.js index 3673ade..ce9c32b 100755 --- a/scribbler.js +++ b/scribbler.js @@ -81,7 +81,8 @@ function setActiveLink(event) { event.target.classList.add('selected'); } -function smoothScrollTo(element, event) { +function smoothScrollTo(i, event) { + var element = sections[i]; setActiveLink(event); window.scrollTo({ @@ -92,26 +93,9 @@ function smoothScrollTo(element, event) { } if (btns.length && sections.length > 0) { -// for (var i = 0; i