From 4f65f041839413af293fdb94bb541bc0192f8dcb Mon Sep 17 00:00:00 2001 From: cubiq Date: Fri, 6 Dec 2013 19:40:22 +0100 Subject: [PATCH] fix scrollend not firing correctly with useTransition:false --- build/iscroll-lite.js | 5 +++-- build/iscroll-probe.js | 5 +++-- build/iscroll-zoom.js | 5 +++-- build/iscroll.js | 5 +++-- demos/barebone/index.html | 2 +- demos/probe/index.html | 2 +- dist/iscroll-lite-min.js | 2 +- dist/iscroll-min.js | 2 +- dist/iscroll-probe-min.js | 2 +- dist/iscroll-zoom-min.js | 2 +- src/core.js | 5 +++-- 11 files changed, 21 insertions(+), 16 deletions(-) diff --git a/build/iscroll-lite.js b/build/iscroll-lite.js index 17af078b..c080d821 100644 --- a/build/iscroll-lite.js +++ b/build/iscroll-lite.js @@ -364,15 +364,16 @@ IScroll.prototype = { this._transitionTime(); - this.isAnimating = false; this.startTime = utils.getTime(); if ( this.options.useTransition && this.isInTransition ) { this.isInTransition = false; - pos = this.getComputedPosition(); this._translate(Math.round(pos.x), Math.round(pos.y)); this._execEvent('scrollEnd'); + } else if ( !this.options.useTransition && this.isAnimating ) { + this.isAnimating = false; + this._execEvent('scrollEnd'); } this.startX = this.x; diff --git a/build/iscroll-probe.js b/build/iscroll-probe.js index 413a7892..9f101b6c 100644 --- a/build/iscroll-probe.js +++ b/build/iscroll-probe.js @@ -391,15 +391,16 @@ IScroll.prototype = { this._transitionTime(); - this.isAnimating = false; this.startTime = utils.getTime(); if ( this.options.useTransition && this.isInTransition ) { this.isInTransition = false; - pos = this.getComputedPosition(); this._translate(Math.round(pos.x), Math.round(pos.y)); this._execEvent('scrollEnd'); + } else if ( !this.options.useTransition && this.isAnimating ) { + this.isAnimating = false; + this._execEvent('scrollEnd'); } this.startX = this.x; diff --git a/build/iscroll-zoom.js b/build/iscroll-zoom.js index 269d2786..dc35d2c4 100644 --- a/build/iscroll-zoom.js +++ b/build/iscroll-zoom.js @@ -397,15 +397,16 @@ IScroll.prototype = { this._transitionTime(); - this.isAnimating = false; this.startTime = utils.getTime(); if ( this.options.useTransition && this.isInTransition ) { this.isInTransition = false; - pos = this.getComputedPosition(); this._translate(Math.round(pos.x), Math.round(pos.y)); this._execEvent('scrollEnd'); + } else if ( !this.options.useTransition && this.isAnimating ) { + this.isAnimating = false; + this._execEvent('scrollEnd'); } this.startX = this.x; diff --git a/build/iscroll.js b/build/iscroll.js index cf35485f..73ef7e4f 100644 --- a/build/iscroll.js +++ b/build/iscroll.js @@ -388,15 +388,16 @@ IScroll.prototype = { this._transitionTime(); - this.isAnimating = false; this.startTime = utils.getTime(); if ( this.options.useTransition && this.isInTransition ) { this.isInTransition = false; - pos = this.getComputedPosition(); this._translate(Math.round(pos.x), Math.round(pos.y)); this._execEvent('scrollEnd'); + } else if ( !this.options.useTransition && this.isAnimating ) { + this.isAnimating = false; + this._execEvent('scrollEnd'); } this.startX = this.x; diff --git a/demos/barebone/index.html b/demos/barebone/index.html index e8a74aa7..9bdff051 100644 --- a/demos/barebone/index.html +++ b/demos/barebone/index.html @@ -51,7 +51,7 @@ } #scroller { - position: relative; + position: absolute; /* Prevent elements to be highlighted on tap */ -webkit-tap-highlight-color: rgba(0,0,0,0); diff --git a/demos/probe/index.html b/demos/probe/index.html index 9c024ff5..38e9a4b4 100644 --- a/demos/probe/index.html +++ b/demos/probe/index.html @@ -29,7 +29,7 @@ document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); -b +