This repository has been archived by the owner on May 31, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景:下拉刷新的容器为界面中某个 div,且 div 高度超过1屏
BUG:界面滚动到一半后,想滑动 div 回到顶部,这时会触发下拉刷新,且界面无法回到顶部
修复:添加 $('body').scrollTop() 的判断
var PTR = function(el) {
this.body = $('body');
this.container = $(el);
this.distance = 50;
this.attachEvents();
}
PTR.prototype.touchMove= function(e) {
if(this.container.hasClass("refreshing")) return;
if(!this.start) return false;
if(this.container.scrollTop() > 0 || this.body.scrollTop() > 0) return;