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