只是一个吸顶效果,拉下来的时候延时复位
listScroll(e) {
let _this = this;
let index;
let fixedHeight = this.data.head_height
let fixedTop = this.data.fixedTop
if (e.detail.scrollTop > fixedTop && !this.data.bfixed) {
this.setData({
bfixed: true
});
} else if (e.detail.scrollTop < fixedTop && this.data.bfixed) {
this.setData({
bfixed: false,
});
}
//console.log(fixedHeight)
//测试方式1
for (let i in _this.data.sectionTopArray) {
if (e.detail.scrollTop > _this.data.sectionTopArray[i].top - fixedHeight) {
index = i
} else {
if (typeof index !== 'undefined') {
if (_this.data.navActiveId !== index) {
_this.setData({
navActiveId: index
});
}
break
}
}
}
},