mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-16 00:49:40 +08:00
perf(pjax): 优化pjax跳转时顶部导航收缩问题
This commit is contained in:
parent
b3b94f73d3
commit
a7f5063869
@ -139,12 +139,12 @@ const commonContext = {
|
||||
},
|
||||
/* 处理滚动 */
|
||||
initScroll() {
|
||||
let initTop = 0
|
||||
window.initTop = 0
|
||||
|
||||
// true:上划,false:下滑
|
||||
function scrollDirection(currentTop) {
|
||||
const result = currentTop > initTop
|
||||
initTop = currentTop
|
||||
const result = currentTop > window.initTop
|
||||
window.initTop = currentTop
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ const initPjax = () => {
|
||||
const computeScrollTop = (target) => {
|
||||
// 当前为横幅大图模式,处理滚动
|
||||
if (target.pathname !== '/' && $('.banner').length !== 0) {
|
||||
// 避免跳转时顶部导航栏收缩
|
||||
window.initTop = 99999999
|
||||
return window.innerHeight / 4
|
||||
}
|
||||
return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user