Elffuss BraidHub

kikocis/iscroll public

mandatory bug fixes after a main release. see release notes
Changeset5d8d38fb472e908bfbc11a0a2679dbc7fe166b0a0b55f1df848e20c7b567bcac
Authorcubiq <matteo@cubiq.org> · 2014-01-09 19:27 +01:00
Committercubiq <matteo@cubiq.org> · 2014-01-09 19:27 +01:00
Parents2a7edf4adfad

Browse the files at this changeset

15 files changed

modified .nodemonignore +2 −1
@@ -1,4 +1,5 @@
11 /build/*
22 /dist/*
33 /demos/*
4-*.md
No newline at the end of the file
4+*.md
5+*.tmp
No newline at the end of the file
modified README.md +12 −4
@@ -1,4 +1,4 @@
1-# iScroll, smooth scrolling for the web
1+<h1 id="intro">iScroll, smooth scrolling for the web</h1>
22
33 iScroll is a high performance, small footprint, dependency free, multi-platform javascript scroller.
44
@@ -71,7 +71,9 @@
7171 Note that iScroll uses `querySelector` not `querySelectorAll`, so only the first occurrence of the selector is used. If you need to apply iScroll to multiple objects you'll have to build your own cycle.
7272
7373 <div class="tip">
74-<p>You don't strictly need to assign the instance to a variable (<code>myScroll</code>), but it is handy to keep a reference to the iScroll (for example you could later check the scroller position).</p>
74+<p>You don't strictly need to assign the instance to a variable (<code>myScroll</code>), but it is handy to keep a reference to the iScroll.</p>
75+
76+For example you could later check the <a href="#scroller-info">scroller position</a> or <a href="#destroy">unload unnecessary events</a> when you don't need the iScroll anymore.</p>
7577 </div>
7678
7779 <h2 id="initialization">Initialization</h2>
@@ -415,7 +417,7 @@
415417
416418 Have a look at the [minimap demo](http://lab.cubiq.org/iscroll5/demos/minimap/) to get a glance at the power of the `indicators` option.
417419
418-The wittiest of you would have noticed that `indicators` is actually plural... Yes, exactly, passing an array of objects you can have a virtually infinite number of indicators. I don't what you may need them for, but hey! who am I to argue about your scrollbar preferences?
420+The wittiest of you would have noticed that `indicators` is actually plural... Yes, exactly, passing an array of objects you can have a virtually infinite number of indicators. I don't know what you may need them for, but hey! who am I to argue about your scrollbar preferences?
419421
420422 ## <span id="parallax-scrolling">Parallax scrolling</span>
421423
@@ -610,6 +612,12 @@
610612
611613 Default: `600`
612614
615+### <small>options.</small>deceleration
616+
617+This value can be altered to change the momentum animation duration/speed. Higher numbers make the animation shorter. Sensible results can be experienced starting with a value of `0.01`, bigger than that basically doesn't make any momentum at all.
618+
619+Default: `0.0006`
620+
613621 ### <small>options.</small>mouseWheelSpeed
614622
615623 Set the speed of the mouse wheel.
@@ -766,7 +774,7 @@
766774 <h2 id="license">License (MIT)</h2>
767775
768776
769-Copyright (c) 2014 Matteo Spinelli, http://cubiq.org/
777+Copyright (c) 2014 Matteo Spinelli, [cubiq.org](http://cubiq.org/)
770778
771779 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
772780
added RELEASENOTES.md +34 −0
@@ -0,0 +1,34 @@
1+# Release notes for iScroll
2+
3+---
4+
5+## Version 5.1.1 - 2014.01.10
6+
7+### Fixes
8+* Infinite scroll now switch from `transform` to `top/left` based on `useTransform` option.
9+* [#555](https://github.com/cubiq/iscroll/issues/555) removed unused variable
10+* [#372](https://github.com/cubiq/iscroll/issues/372) case insensitive check on tag names
11+
12+### New features
13+* New `off` method to unload custom events
14+* Added `options.deceleration` to alter the momentum duration/speed
15+* Added release notes file
16+
17+---
18+
19+## Version 5.1.0 - 2014.01.09
20+
21+### Fixes
22+* [#558](https://github.com/cubiq/iscroll/issues/558) false positive for `isBadAndroid`
23+
24+### New features
25+* Infinite scrolling
26+* Documentation
27+* `_execEvent` supports arguments
28+
29+### Changes
30+* dist/minified files are no longer pushed to the main repo
31+
32+---
33+
34+*I started collecting release notes from version 5.1.0*
No newline at the end of the file
modified build/iscroll-infinite.js +30 −9
@@ -1,4 +1,4 @@
1-/*! iScroll v5.1.0 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
1+/*! iScroll v5.1.1 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
22 (function (window, document, Math) {
33 var rAF = window.requestAnimationFrame ||
44 window.webkitRequestAnimationFrame ||
@@ -47,12 +47,13 @@
4747 el.removeEventListener(type, fn, !!capture);
4848 };
4949
50- me.momentum = function (current, start, time, lowerMargin, wrapperSize) {
50+ me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
5151 var distance = current - start,
5252 speed = Math.abs(distance) / time,
5353 destination,
54- duration,
55- deceleration = 0.0006;
54+ duration;
55+
56+ deceleration = deceleration === undefined ? 0.0006 : deceleration;
5657
5758 destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
5859 duration = speed / deceleration;
@@ -219,7 +220,7 @@
219220 var target = e.target,
220221 ev;
221222
222- if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
223+ if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
223224 ev = document.createEvent('MouseEvents');
224225 ev.initMouseEvent('click', true, true, e.view, 1,
225226 target.screenX, target.screenY, target.clientX, target.clientY,
@@ -245,6 +246,9 @@
245246
246247 snapThreshold: 0.334,
247248
249+ infiniteUseTransform: true,
250+ deceleration: 0.004,
251+
248252 // INSERT POINT: OPTIONS
249253
250254 startX: 0,
@@ -299,6 +303,7 @@
299303 if ( this.options.infiniteElements ) {
300304 this.options.probeType = 3;
301305 }
306+ this.options.infiniteUseTransform = this.options.infiniteUseTransform && this.options.useTransform;
302307
303308 if ( this.options.probeType == 3 ) {
304309 this.options.useTransition = false; }
@@ -322,7 +327,7 @@
322327 }
323328
324329 IScroll.prototype = {
325- version: '5.1.0',
330+ version: '5.1.1',
326331
327332 _init: function () {
328333 this._initEvents();
@@ -571,8 +576,8 @@
571576
572577 // start momentum animation if needed
573578 if ( this.options.momentum && duration < 300 ) {
574- momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0) : { destination: newX, duration: 0 };
575- momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0) : { destination: newY, duration: 0 };
579+ momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
580+ momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
576581 newX = momentumX.destination;
577582 newY = momentumY.destination;
578583 time = Math.max(momentumX.duration, momentumY.duration);
@@ -711,6 +716,18 @@
711716 this._events[type].push(fn);
712717 },
713718
719+ off: function (type, fn) {
720+ if ( !this._events[type] ) {
721+ return;
722+ }
723+
724+ var index = this._events[type].indexOf(fn);
725+
726+ if ( index > -1 ) {
727+ this._events[type].splice(index, 1);
728+ }
729+ },
730+
714731 _execEvent: function (type) {
715732 if ( !this._events[type] ) {
716733 return;
@@ -1443,7 +1460,11 @@
14431460
14441461 if ( this.infiniteElements[i]._phase < this.options.infiniteLimit ) {
14451462 this.infiniteElements[i]._top = top;
1446- this.infiniteElements[i].style.top = top + 'px';
1463+ if ( this.options.infiniteUseTransform ) {
1464+ this.infiniteElements[i].style[utils.style.transform] = 'translate(0, ' + top + 'px)' + this.translateZ;
1465+ } else {
1466+ this.infiniteElements[i].style.top = top + 'px';
1467+ }
14471468 update.push(this.infiniteElements[i]);
14481469 }
14491470 }
modified build/iscroll-lite.js +21 −8
@@ -1,4 +1,4 @@
1-/*! iScroll v5.1.0 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
1+/*! iScroll v5.1.1 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
22 (function (window, document, Math) {
33 var rAF = window.requestAnimationFrame ||
44 window.webkitRequestAnimationFrame ||
@@ -47,12 +47,13 @@
4747 el.removeEventListener(type, fn, !!capture);
4848 };
4949
50- me.momentum = function (current, start, time, lowerMargin, wrapperSize) {
50+ me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
5151 var distance = current - start,
5252 speed = Math.abs(distance) / time,
5353 destination,
54- duration,
55- deceleration = 0.0006;
54+ duration;
55+
56+ deceleration = deceleration === undefined ? 0.0006 : deceleration;
5657
5758 destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
5859 duration = speed / deceleration;
@@ -219,7 +220,7 @@
219220 var target = e.target,
220221 ev;
221222
222- if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
223+ if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
223224 ev = document.createEvent('MouseEvents');
224225 ev.initMouseEvent('click', true, true, e.view, 1,
225226 target.screenX, target.screenY, target.clientX, target.clientY,
@@ -309,7 +310,7 @@
309310 }
310311
311312 IScroll.prototype = {
312- version: '5.1.0',
313+ version: '5.1.1',
313314
314315 _init: function () {
315316 this._initEvents();
@@ -536,8 +537,8 @@
536537
537538 // start momentum animation if needed
538539 if ( this.options.momentum && duration < 300 ) {
539- momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0) : { destination: newX, duration: 0 };
540- momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0) : { destination: newY, duration: 0 };
540+ momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
541+ momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
541542 newX = momentumX.destination;
542543 newY = momentumY.destination;
543544 time = Math.max(momentumX.duration, momentumY.duration);
@@ -655,6 +656,18 @@
655656 this._events[type].push(fn);
656657 },
657658
659+ off: function (type, fn) {
660+ if ( !this._events[type] ) {
661+ return;
662+ }
663+
664+ var index = this._events[type].indexOf(fn);
665+
666+ if ( index > -1 ) {
667+ this._events[type].splice(index, 1);
668+ }
669+ },
670+
658671 _execEvent: function (type) {
659672 if ( !this._events[type] ) {
660673 return;
modified build/iscroll-probe.js +21 −9
@@ -1,4 +1,4 @@
1-/*! iScroll v5.1.0 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
1+/*! iScroll v5.1.1 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
22 (function (window, document, Math) {
33 var rAF = window.requestAnimationFrame ||
44 window.webkitRequestAnimationFrame ||
@@ -47,12 +47,13 @@
4747 el.removeEventListener(type, fn, !!capture);
4848 };
4949
50- me.momentum = function (current, start, time, lowerMargin, wrapperSize) {
50+ me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
5151 var distance = current - start,
5252 speed = Math.abs(distance) / time,
5353 destination,
54- duration,
55- deceleration = 0.0006;
54+ duration;
55+
56+ deceleration = deceleration === undefined ? 0.0006 : deceleration;
5657
5758 destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
5859 duration = speed / deceleration;
@@ -219,7 +220,7 @@
219220 var target = e.target,
220221 ev;
221222
222- if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
223+ if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
223224 ev = document.createEvent('MouseEvents');
224225 ev.initMouseEvent('click', true, true, e.view, 1,
225226 target.screenX, target.screenY, target.clientX, target.clientY,
@@ -324,7 +325,7 @@
324325 }
325326
326327 IScroll.prototype = {
327- version: '5.1.0',
328+ version: '5.1.1',
328329
329330 _init: function () {
330331 this._initEvents();
@@ -573,8 +574,8 @@
573574
574575 // start momentum animation if needed
575576 if ( this.options.momentum && duration < 300 ) {
576- momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0) : { destination: newX, duration: 0 };
577- momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0) : { destination: newY, duration: 0 };
577+ momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
578+ momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
578579 newX = momentumX.destination;
579580 newY = momentumY.destination;
580581 time = Math.max(momentumX.duration, momentumY.duration);
@@ -709,6 +710,18 @@
709710 this._events[type].push(fn);
710711 },
711712
713+ off: function (type, fn) {
714+ if ( !this._events[type] ) {
715+ return;
716+ }
717+
718+ var index = this._events[type].indexOf(fn);
719+
720+ if ( index > -1 ) {
721+ this._events[type].splice(index, 1);
722+ }
723+ },
724+
712725 _execEvent: function (type) {
713726 if ( !this._events[type] ) {
714727 return;
@@ -902,7 +915,6 @@
902915
903916 _initIndicators: function () {
904917 var interactive = this.options.interactiveScrollbars,
905- defaultScrollbars = typeof this.options.scrollbars != 'object',
906918 customStyle = typeof this.options.scrollbars != 'string',
907919 indicators = [],
908920 indicator;
modified build/iscroll-zoom.js +21 −9
@@ -1,4 +1,4 @@
1-/*! iScroll v5.1.0 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
1+/*! iScroll v5.1.1 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
22 (function (window, document, Math) {
33 var rAF = window.requestAnimationFrame ||
44 window.webkitRequestAnimationFrame ||
@@ -47,12 +47,13 @@
4747 el.removeEventListener(type, fn, !!capture);
4848 };
4949
50- me.momentum = function (current, start, time, lowerMargin, wrapperSize) {
50+ me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
5151 var distance = current - start,
5252 speed = Math.abs(distance) / time,
5353 destination,
54- duration,
55- deceleration = 0.0006;
54+ duration;
55+
56+ deceleration = deceleration === undefined ? 0.0006 : deceleration;
5657
5758 destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
5859 duration = speed / deceleration;
@@ -219,7 +220,7 @@
219220 var target = e.target,
220221 ev;
221222
222- if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
223+ if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
223224 ev = document.createEvent('MouseEvents');
224225 ev.initMouseEvent('click', true, true, e.view, 1,
225226 target.screenX, target.screenY, target.clientX, target.clientY,
@@ -326,7 +327,7 @@
326327 }
327328
328329 IScroll.prototype = {
329- version: '5.1.0',
330+ version: '5.1.1',
330331
331332 _init: function () {
332333 this._initEvents();
@@ -573,8 +574,8 @@
573574
574575 // start momentum animation if needed
575576 if ( this.options.momentum && duration < 300 ) {
576- momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0) : { destination: newX, duration: 0 };
577- momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0) : { destination: newY, duration: 0 };
577+ momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
578+ momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
578579 newX = momentumX.destination;
579580 newY = momentumY.destination;
580581 time = Math.max(momentumX.duration, momentumY.duration);
@@ -707,6 +708,18 @@
707708 this._events[type].push(fn);
708709 },
709710
711+ off: function (type, fn) {
712+ if ( !this._events[type] ) {
713+ return;
714+ }
715+
716+ var index = this._events[type].indexOf(fn);
717+
718+ if ( index > -1 ) {
719+ this._events[type].splice(index, 1);
720+ }
721+ },
722+
710723 _execEvent: function (type) {
711724 if ( !this._events[type] ) {
712725 return;
@@ -896,7 +909,6 @@
896909
897910 _initIndicators: function () {
898911 var interactive = this.options.interactiveScrollbars,
899- defaultScrollbars = typeof this.options.scrollbars != 'object',
900912 customStyle = typeof this.options.scrollbars != 'string',
901913 indicators = [],
902914 indicator;
modified build/iscroll.js +21 −9
@@ -1,4 +1,4 @@
1-/*! iScroll v5.1.0 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
1+/*! iScroll v5.1.1 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
22 (function (window, document, Math) {
33 var rAF = window.requestAnimationFrame ||
44 window.webkitRequestAnimationFrame ||
@@ -47,12 +47,13 @@
4747 el.removeEventListener(type, fn, !!capture);
4848 };
4949
50- me.momentum = function (current, start, time, lowerMargin, wrapperSize) {
50+ me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
5151 var distance = current - start,
5252 speed = Math.abs(distance) / time,
5353 destination,
54- duration,
55- deceleration = 0.0006;
54+ duration;
55+
56+ deceleration = deceleration === undefined ? 0.0006 : deceleration;
5657
5758 destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
5859 duration = speed / deceleration;
@@ -219,7 +220,7 @@
219220 var target = e.target,
220221 ev;
221222
222- if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
223+ if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
223224 ev = document.createEvent('MouseEvents');
224225 ev.initMouseEvent('click', true, true, e.view, 1,
225226 target.screenX, target.screenY, target.clientX, target.clientY,
@@ -321,7 +322,7 @@
321322 }
322323
323324 IScroll.prototype = {
324- version: '5.1.0',
325+ version: '5.1.1',
325326
326327 _init: function () {
327328 this._initEvents();
@@ -564,8 +565,8 @@
564565
565566 // start momentum animation if needed
566567 if ( this.options.momentum && duration < 300 ) {
567- momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0) : { destination: newX, duration: 0 };
568- momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0) : { destination: newY, duration: 0 };
568+ momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
569+ momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
569570 newX = momentumX.destination;
570571 newY = momentumY.destination;
571572 time = Math.max(momentumX.duration, momentumY.duration);
@@ -700,6 +701,18 @@
700701 this._events[type].push(fn);
701702 },
702703
704+ off: function (type, fn) {
705+ if ( !this._events[type] ) {
706+ return;
707+ }
708+
709+ var index = this._events[type].indexOf(fn);
710+
711+ if ( index > -1 ) {
712+ this._events[type].splice(index, 1);
713+ }
714+ },
715+
703716 _execEvent: function (type) {
704717 if ( !this._events[type] ) {
705718 return;
@@ -893,7 +906,6 @@
893906
894907 _initIndicators: function () {
895908 var interactive = this.options.interactiveScrollbars,
896- defaultScrollbars = typeof this.options.scrollbars != 'object',
897909 customStyle = typeof this.options.scrollbars != 'string',
898910 indicators = [],
899911 indicator;
modified demos/infinite/index.html +0 −1
@@ -67,7 +67,6 @@
6767 dataFiller: updateContent,
6868 cacheSize: 1000
6969 });
70- console.log(myScroll.options)
7170 }
7271
7372 function requestData (start, count) {
modified package.json +1 −1
@@ -1,7 +1,7 @@
11 {
22 "name": "iscroll",
33 "description": "Smooth scrolling for the web",
4- "version": "5.1.0",
4+ "version": "5.1.1",
55 "homepage": "http://cubiq.org/iscroll-4",
66 "author": "Matteo Spinelli <matteo@cubiq.org> (http://cubiq.org)",
77 "keywords": [
modified src/core.js +14 −2
@@ -301,8 +301,8 @@
301301
302302 // start momentum animation if needed
303303 if ( this.options.momentum && duration < 300 ) {
304- momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0) : { destination: newX, duration: 0 };
305- momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0) : { destination: newY, duration: 0 };
304+ momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
305+ momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
306306 newX = momentumX.destination;
307307 newY = momentumY.destination;
308308 time = Math.max(momentumX.duration, momentumY.duration);
@@ -420,6 +420,18 @@
420420 this._events[type].push(fn);
421421 },
422422
423+ off: function (type, fn) {
424+ if ( !this._events[type] ) {
425+ return;
426+ }
427+
428+ var index = this._events[type].indexOf(fn);
429+
430+ if ( index > -1 ) {
431+ this._events[type].splice(index, 1);
432+ }
433+ },
434+
423435 _execEvent: function (type) {
424436 if ( !this._events[type] ) {
425437 return;
modified src/indicator/_initIndicators.js +0 −1
@@ -1,7 +1,6 @@
11
22 _initIndicators: function () {
33 var interactive = this.options.interactiveScrollbars,
4- defaultScrollbars = typeof this.options.scrollbars != 'object',
54 customStyle = typeof this.options.scrollbars != 'string',
65 indicators = [],
76 indicator;
modified src/infinite/build.json +2 −1
@@ -1,6 +1,7 @@
11 {
22 "insert": {
3- "NORMALIZATION": "\tif ( this.options.infiniteElements ) {\n\t\tthis.options.probeType = 3;\n\t}",
3+ "OPTIONS": "\t\tinfiniteUseTransform: true,\n\t\tdeceleration: 0.004,",
4+ "NORMALIZATION": "\tif ( this.options.infiniteElements ) {\n\t\tthis.options.probeType = 3;\n\t}\n\tthis.options.infiniteUseTransform = this.options.infiniteUseTransform && this.options.useTransform;",
45 "_init": "\t\tif ( this.options.infiniteElements ) {\n\t\t\tthis._initInfinite();\n\t\t}"
56 },
67 "replace": {
modified src/infinite/infinite.js +5 −1
@@ -50,7 +50,11 @@
5050
5151 if ( this.infiniteElements[i]._phase < this.options.infiniteLimit ) {
5252 this.infiniteElements[i]._top = top;
53- this.infiniteElements[i].style.top = top + 'px';
53+ if ( this.options.infiniteUseTransform ) {
54+ this.infiniteElements[i].style[utils.style.transform] = 'translate(0, ' + top + 'px)' + this.translateZ;
55+ } else {
56+ this.infiniteElements[i].style.top = top + 'px';
57+ }
5458 update.push(this.infiniteElements[i]);
5559 }
5660 }
modified src/utils.js +5 −4
@@ -45,12 +45,13 @@
4545 el.removeEventListener(type, fn, !!capture);
4646 };
4747
48- me.momentum = function (current, start, time, lowerMargin, wrapperSize) {
48+ me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
4949 var distance = current - start,
5050 speed = Math.abs(distance) / time,
5151 destination,
52- duration,
53- deceleration = 0.0006;
52+ duration;
53+
54+ deceleration = deceleration === undefined ? 0.0006 : deceleration;
5455
5556 destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
5657 duration = speed / deceleration;
@@ -217,7 +218,7 @@
217218 var target = e.target,
218219 ev;
219220
220- if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
221+ if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
221222 ev = document.createEvent('MouseEvents');
222223 ev.initMouseEvent('click', true, true, e.view, 1,
223224 target.screenX, target.screenY, target.clientX, target.clientY,