Skip to content

Commit

Permalink
fix scrollend not firing correctly with useTransition:false
Browse files Browse the repository at this point in the history
  • Loading branch information
cubiq committed Dec 6, 2013
1 parent 3bed379 commit 4f65f04
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 16 deletions.
5 changes: 3 additions & 2 deletions build/iscroll-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions build/iscroll-probe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions build/iscroll-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions build/iscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion demos/barebone/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion demos/probe/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);

</script>
b

<style type="text/css">
* {
-webkit-box-sizing: border-box;
Expand Down
2 changes: 1 addition & 1 deletion dist/iscroll-lite-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iscroll-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iscroll-probe-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iscroll-zoom-min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,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;
Expand Down

0 comments on commit 4f65f04

Please sign in to comment.