Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

轮播图手势滑动,会触发下拉刷新事件 #27

Open
ferqx opened this issue Apr 17, 2017 · 2 comments
Open

轮播图手势滑动,会触发下拉刷新事件 #27

ferqx opened this issue Apr 17, 2017 · 2 comments

Comments

@ferqx
Copy link

ferqx commented Apr 17, 2017

当使用下拉刷新时,内容界面存在轮播图,当滑动轮播图时会触发下拉事件,需要在手势滑动轮播图时清除事件冒泡。event.stopPropagation();

如下所示:
auiSlide.prototype.touchStart = function(event) {
event.stopPropagation();
touchStartTime = new Date() * 1;
firstTouchX = parseInt(event.changedTouches[0].pageX);
firstTouchY = parseInt(event.changedTouches[0].pageY);
isScrolling = undefined;
};

@ferqx
Copy link
Author

ferqx commented Apr 17, 2017

请在aui-slide.js这个js文件中,204行下方:

if(!isScrolling){
event.preventDefault();
event.stopPropagation(); //添加该方法,防止轮播图滚动时,触发下拉刷新
if(!this.loop){ //不循环
if(!this.continuous && this.index==1 && direction=='left'){
return;
}
if(!this.continuous && this.index==0 && direction=='right'){
return;
}

@ferqx
Copy link
Author

ferqx commented Apr 17, 2017

也希望能在该保存的地方缓存this或者其他变量,你们在干嘛呢?额?

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

No branches or pull requests

1 participant