js上拉刷新,下拉加载滚动事件监控(滚动区域为body)
作者:
爱忽悠的唐唐在晃悠 | 来源:发表于
2018-07-19 10:51 被阅读21次 handleScroll () {
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
this.scroll = scrollTop
// 变量windowHeight是可视区的高度
let windowHeight = document.documentElement.clientHeight || document.body.clientHeight
// 变量scrollHeight是滚动条的总高度
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight
if (scrollTop + windowHeight === scrollHeight && (this.productList.length !== this.total)) {
if (!this.loadData) {
this.loadData = true
this.loadMoreTips = '加载更多中...'
this.nextPage()
}
}
}
本文标题:js上拉刷新,下拉加载滚动事件监控(滚动区域为body)
本文链接:https://www.haomeiwen.com/subject/uggzpftx.html
网友评论