🕶 侧边栏微调

This commit is contained in:
tangly1024
2021-09-29 13:16:40 +08:00
parent a9f99ae51a
commit 1fca1281f9
4 changed files with 23 additions and 20 deletions

View File

@@ -50,14 +50,14 @@ const DefaultLayout = ({ tags, posts, page, currentTag, ...customMeta }) => {
// if (ref) {
// ref.remove()
// }
window.addEventListener('resize', resizeWindowHideToc)
resizeWindowHideToc()
window.addEventListener('resize', changeColumnCount)
changeColumnCount()
return () => {
window.removeEventListener('resize', resizeWindowHideToc)
window.removeEventListener('resize', changeColumnCount)
}
}, [])
const resizeWindowHideToc = throttle(() => {
const changeColumnCount = throttle(() => {
if (window.innerWidth > 2500) {
changeColumn(5)
} else if (window.innerWidth > 1800) {