From 6a223b2ab3d91dbe80410606376b7165b129a783 Mon Sep 17 00:00:00 2001 From: ice-lord <33343143+ice-lord@users.noreply.github.com> Date: Fri, 3 Nov 2017 18:17:13 +0800 Subject: [PATCH] Update mui.class.scroll.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决某些情况下wrapper发生原生滚动导致组件无法向上回滚的问题 --- js/mui.class.scroll.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/mui.class.scroll.js b/js/mui.class.scroll.js index afe11910..e06a4cae 100644 --- a/js/mui.class.scroll.js +++ b/js/mui.class.scroll.js @@ -700,7 +700,8 @@ }, resetPosition: function(time) { var x = this.x, - y = this.y; + y = this.y, + dy = this.wrapper.scrollTop; time = time || 0; if (!this.hasHorizontalScroll || this.x > 0) { @@ -715,6 +716,10 @@ y = this.maxScrollY; } + if(dy > 0){ + this.wrapper.scrollTop = 0; + y -= dy; + } if (x == this.x && y == this.y) { return false; } @@ -935,4 +940,4 @@ }); return scrollApis.length === 1 ? scrollApis[0] : scrollApis; }; -})(mui, window, document); \ No newline at end of file +})(mui, window, document);