refactor(plugins): update search plugin

This commit is contained in:
qingwei.li 2017-02-19 10:47:47 +08:00 • committed by cinwell.li
commit 079bd00395
22 changed files with 348 additions and 393 deletions

View file

@ -45,8 +45,8 @@ export function scrollActiveSidebar () {
const li = nav[last.getAttribute('data-id')]
if (!li || li === active) return
if (active) active.classList.remove('active')
active && active.classList.remove('active')
li.classList.add('active')
active = li
@ -79,7 +79,7 @@ export function scrollActiveSidebar () {
export function scrollIntoView (id) {
const section = dom.find('#' + id)
section && setTimeout(() => section.scrollIntoView(), 0)
section && section.scrollIntoView()
}
const scrollEl = dom.$.scrollingElement || dom.$.documentElement