Fix menu toggle style

This commit is contained in:
qingwei.li 2016-12-31 14:53:27 +08:00
commit b4e0d54d7b
4 changed files with 31 additions and 17 deletions

View file

@ -94,19 +94,14 @@ export function bindToggle (dom) {
dom.addEventListener('click', () => body.classList.toggle('close'))
if (!/mobile/i.test(navigator.userAgent)) return
document.querySelector('aside').addEventListener('click', event => {
body.classList.toggle('close')
})
if (isMobile()) {
document.querySelector('aside')
.addEventListener('click', _ => body.classList.toggle('close'))
}
}
let cacheContentDOM
export function scroll2Top () {
if (!cacheContentDOM) {
const dom = isMobile() ? 'body' : 'section.content'
cacheContentDOM = document.querySelector(dom)
}
cacheContentDOM.scrollTop = 0
document.body.scrollTop = 0
}
export function sticky () {