Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
iscroll fires two scrollEnd events
Browse files Browse the repository at this point in the history
when using mousewheel:true and snap:true options

Close #761
  • Loading branch information
sculove committed Apr 1, 2016
1 parent 0bfc861 commit eed1f7b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
8 changes: 5 additions & 3 deletions build/iscroll-infinite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3-master ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -365,7 +365,7 @@ function IScroll (el, options) {
}

IScroll.prototype = {
version: '5.1.3',
version: '5.1.3-master',

_init: function () {
this._initEvents();
Expand Down Expand Up @@ -974,7 +974,9 @@ IScroll.prototype = {
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
clearTimeout(this.wheelTimeout);
this.wheelTimeout = setTimeout(function () {
that._execEvent('scrollEnd');
if(!that.options.snap) {
that._execEvent('scrollEnd');
}
that.wheelTimeout = undefined;
}, 400);

Expand Down
4 changes: 2 additions & 2 deletions build/iscroll-lite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3-master ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -348,7 +348,7 @@ function IScroll (el, options) {
}

IScroll.prototype = {
version: '5.1.3',
version: '5.1.3-master',

_init: function () {
this._initEvents();
Expand Down
8 changes: 5 additions & 3 deletions build/iscroll-probe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3-master ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -363,7 +363,7 @@ function IScroll (el, options) {
}

IScroll.prototype = {
version: '5.1.3',
version: '5.1.3-master',

_init: function () {
this._initEvents();
Expand Down Expand Up @@ -1098,7 +1098,9 @@ IScroll.prototype = {
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
clearTimeout(this.wheelTimeout);
this.wheelTimeout = setTimeout(function () {
that._execEvent('scrollEnd');
if(!that.options.snap) {
that._execEvent('scrollEnd');
}
that.wheelTimeout = undefined;
}, 400);

Expand Down
8 changes: 5 additions & 3 deletions build/iscroll-zoom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3-master ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -365,7 +365,7 @@ function IScroll (el, options) {
}

IScroll.prototype = {
version: '5.1.3',
version: '5.1.3-master',

_init: function () {
this._initEvents();
Expand Down Expand Up @@ -1262,7 +1262,9 @@ IScroll.prototype = {
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
clearTimeout(this.wheelTimeout);
this.wheelTimeout = setTimeout(function () {
that._execEvent('scrollEnd');
if(!that.options.snap) {
that._execEvent('scrollEnd');
}
that.wheelTimeout = undefined;
}, 400);

Expand Down
8 changes: 5 additions & 3 deletions build/iscroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! iScroll v5.1.3 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
/*! iScroll v5.1.3-master ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
Expand Down Expand Up @@ -360,7 +360,7 @@ function IScroll (el, options) {
}

IScroll.prototype = {
version: '5.1.3',
version: '5.1.3-master',

_init: function () {
this._initEvents();
Expand Down Expand Up @@ -1089,7 +1089,9 @@ IScroll.prototype = {
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
clearTimeout(this.wheelTimeout);
this.wheelTimeout = setTimeout(function () {
that._execEvent('scrollEnd');
if(!that.options.snap) {
that._execEvent('scrollEnd');
}
that.wheelTimeout = undefined;
}, 400);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "iscroll",
"description": "Smooth scrolling for the web",
"version": "5.1.3",
"version": "5.1.3-master",
"homepage": "http://cubiq.org/iscroll-4",
"author": "Matteo Spinelli <matteo@cubiq.org> (http://cubiq.org)",
"keywords": [
Expand Down
4 changes: 3 additions & 1 deletion src/wheel/wheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
clearTimeout(this.wheelTimeout);
this.wheelTimeout = setTimeout(function () {
that._execEvent('scrollEnd');
if(!that.options.snap) {
that._execEvent('scrollEnd');
}
that.wheelTimeout = undefined;
}, 400);

Expand Down

0 comments on commit eed1f7b

Please sign in to comment.