Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

fix 下拉刷新,当容器不是body时的bug #191

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

SugarLSG
Copy link

背景:下拉刷新的容器为界面中某个 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;

@chang0022
Copy link

是否是
if(this.container.scrollTop() > 0 || $('body').scrollTop() > 0) return;

if(this.container.scrollTop() > 0 || $(document.body).scrollTop() > 0) return;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants