Fix menu toggle style
This commit is contained in:
parent
b15b286c5c
commit
b4e0d54d7b
4 changed files with 31 additions and 17 deletions
15
src/event.js
15
src/event.js
|
|
@ -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 () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue