virtual-scroll
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "virtual-scroll", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Smooth fake scroll using CSS transform", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -40,2 +40,3 @@ virtual-scroll | ||
- preventTouch: If true, automatically call `e.preventDefault` on touchMove. *Default is false.* | ||
- unpreventTouchClass: Elements with this class won't `preventDefault` on touchMove. For instance, useful for a scrolling text inside a VirtualScroll-controled element. *Default is `vs-touchmove-allowed`*. | ||
- limitInertia: if true, will leverage [Lethargy](https://github.com/d4nyll/lethargy) to avoid everlasting scroll events (mostly on Apple Mouse, Trackpad, and free-wheel mouse). *Default is false.* | ||
@@ -42,0 +43,0 @@ |
@@ -29,2 +29,3 @@ 'use strict'; | ||
preventTouch: false, | ||
unpreventTouchClass: 'vs-touchmove-allowed', | ||
limitInertia: false | ||
@@ -100,3 +101,8 @@ }); | ||
VirtualScroll.prototype._onTouchMove = function(e) { | ||
if(this.options.preventTouch) e.preventDefault(); | ||
var options = this.options; | ||
if(options.preventTouch | ||
&& !e.target.classList.contains(options.unpreventTouchClass)) { | ||
e.preventDefault(); | ||
} | ||
var evt = this._event; | ||
@@ -106,4 +112,4 @@ | ||
evt.deltaX = (t.pageX - this.touchStartX) * this.options.touchMultiplier; | ||
evt.deltaY = (t.pageY - this.touchStartY) * this.options.touchMultiplier; | ||
evt.deltaX = (t.pageX - this.touchStartX) * options.touchMultiplier; | ||
evt.deltaY = (t.pageY - this.touchStartY) * options.touchMultiplier; | ||
@@ -110,0 +116,0 @@ this.touchStartX = t.pageX; |
10927
177
46