From da3610f88c08454763a59207aa6a09a7d6b7b3e0 Mon Sep 17 00:00:00 2001 From: JoeLucky <347126391@qq.com> Date: Mon, 17 Jul 2017 17:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=A8=AA=E7=AB=96=E5=B1=8F?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E9=A1=B5=E9=9D=A2=E9=80=89=E6=8B=A9=E5=87=BA?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在滑动切换下拉刷新页那个demo里面,当为refresh时,不应该再通过近似值重新计算currentPage --- js/mui.class.scroll.js | 2 +- js/mui.class.scroll.slider.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/mui.class.scroll.js b/js/mui.class.scroll.js index afe11910..b8f7057e 100644 --- a/js/mui.class.scroll.js +++ b/js/mui.class.scroll.js @@ -736,7 +736,7 @@ this._reInit(); this.reLayout(); $.trigger(this.scroller, 'refresh', this); - this.resetPosition(); + this.resetPosition(0,true); }, scrollTo: function(x, y, time, easing) { var easing = easing || ease.circular; diff --git a/js/mui.class.scroll.slider.js b/js/mui.class.scroll.slider.js index 762fdc26..0c8b9448 100644 --- a/js/mui.class.scroll.slider.js +++ b/js/mui.class.scroll.slider.js @@ -316,14 +316,16 @@ this.progressBarStyle.webkitTransform = this._getTranslateStr((-x * (this.progressBarWidth / this.wrapperWidth)), 0); } }, - resetPosition: function(time) { + resetPosition: function(time, byCurrentSelect) { time = time || 0; if (this.x > 0) { this.x = 0; } else if (this.x < this.maxScrollX) { this.x = this.maxScrollX; } - this.currentPage = this._nearestSnap(this.x); + if(!byCurrentSelect){ + this.currentPage = this._nearestSnap(this.x); + } this.scrollTo(this.currentPage.x, 0, time, this.options.scrollEasing); return true; },