拖把耶
拖把耶
  • 发布:2015-09-20 08:47
  • 更新:2015-09-20 09:50
  • 阅读:2319

iOS 侧滑和下拉刷新冲突

分类:MUI

IOS 的侧滑返回/关闭

跟MUI 的下拉刷新 冲突啊.只要设置了pullRefresh 滑动返回就无效的
好蛋疼

我做文章是详情页面,下面的评论需要 上拉加载更多的, 但是无法滑动返回了...

2015-09-20 08:47 负责人:无 分享
已邀请:
徐家大哥

徐家大哥

需要在下啦的WebView上设置遮罩,并实现关闭遮罩返回

拖把耶

拖把耶 (作者)

分享下吧.自己改了下,
在Scroll里面添加个属性
locked:false //是否锁定滚动条

_start: function(e) {  
            e.target && !this._preventDefaultException(e.target, this.options.preventDefaultException) && e.preventDefault();  
            this.moved = this.needReset = false;  
            this._transitionTime();  
            if (this.isInTransition) {  
                this.needReset = true;  
                this.isInTransition = false;  
                var pos = $.parseTranslateMatrix($.getStyles(this.scroller, 'webkitTransform'));  
                this.setTranslate(Math.round(pos.x), Math.round(pos.y));  
                //              this.resetPosition(); //reset  
                $.trigger(this.scroller, 'scrollend', this);  
                //              e.stopPropagation();  
                e.preventDefault();  
            }  
            this.reLayout();  
            $.trigger(this.scroller, 'beforescrollstart', this);  
        },

里面的第一行 e.target && !this._preventDefaultException(e.target, this.options.preventDefaultException) && e.preventDefault();
阻止默认事件的代码给删掉
修改代码
if (detail.direction === 'left' || detail.direction === 'right') {
if (this.options.scrollX) {
isPreventDefault = true;
if (!this.moved) { //识别角度(该角度导致轮播不灵敏)
// if (direction !== 'left' && direction !== 'right') {
// isReturn = true;
// } else {
$.gestures.session.lockDirection = true; //锁定方向
$.gestures.session.startDirection = detail.direction;
// }
}
} else{
this.locked = true;
return;
}
}

在 flick里面 把 设置this.locked = false

大体的意思, 是

当有下拉刷新的时候..Scroll 会把默认的 IOS 返回事件给阻止的,

我把相关代码去掉, 添加了个locked 属性,默认的是不锁定

当 第一次开始滑动的时候,如果是左右滑动,就把上下滑动给锁定,然后执行IOS 默认的返回效果

当执行触摸结束的时候,再把locked 解锁

不晓得 对其他的地方可有什么影响..反正目前能实现 拉下刷新跟IOS 滑动返回的功能

该问题目前已经被锁定, 无法添加新回复