Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ export default class Smooth {
ticking: false
}
this.vs = this.vars.native ? null : new vs({
limitInertia: this.options.vs && this.options.vs.limitInertia || false,
limitInertia: this.options.vs && this.options.vs.hasOwnProperty('limitInertia') ? this.options.vs.limitInertia : false,
mouseMultiplier: this.options.vs && this.options.vs.mouseMultiplier || 1,
touchMultiplier: this.options.vs && this.options.vs.touchMultiplier || 1.5,
firefoxMultiplier: this.options.vs && this.options.vs.firefoxMultiplier || 30,
preventTouch: this.options.vs && this.options.vs.preventTouch || true
useKeyboard: this.options.vs && this.options.vs.hasOwnProperty('useKeyboard') ? this.options.vs.useKeyboard : true,
preventTouch: this.options.vs && this.options.vs.hasOwnProperty('preventTouch') ? this.options.vs.preventTouch : true,
passive: this.options.vs && this.options.vs.hasOwnProperty('passive') ? this.options.vs.passive : undefined,
})
this.dom = {
listener: this.options.listener || document.body,
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dom-create-element": "^1.0.2",
"dom-events": "^0.1.1",
"prefix": "^1.0.0",
"virtual-scroll": "^1.2.1"
"virtual-scroll": "^1.5.1"
},
"devDependencies": {
"@babel/core": "^7.4.4",
Expand Down
16 changes: 10 additions & 6 deletions smooth-scrolling.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ function () {
ticking: false
};
this.vs = this.vars["native"] ? null : new _virtualScroll["default"]({
limitInertia: this.options.vs && this.options.vs.limitInertia || false,
limitInertia: this.options.vs && this.options.vs.hasOwnProperty('limitInertia') ? this.options.vs.limitInertia : false,
mouseMultiplier: this.options.vs && this.options.vs.mouseMultiplier || 1,
touchMultiplier: this.options.vs && this.options.vs.touchMultiplier || 1.5,
firefoxMultiplier: this.options.vs && this.options.vs.firefoxMultiplier || 30,
preventTouch: this.options.vs && this.options.vs.preventTouch || true
useKeyboard: this.options.vs && this.options.vs.hasOwnProperty('useKeyboard') ? this.options.vs.useKeyboard : true,
preventTouch: this.options.vs && this.options.vs.hasOwnProperty('preventTouch') ? this.options.vs.preventTouch : true,
passive: this.options.vs && this.options.vs.hasOwnProperty('passive') ? this.options.vs.passive : undefined
});
this.dom = {
listener: this.options.listener || document.body,
Expand Down Expand Up @@ -1246,7 +1248,9 @@ function VirtualScroll(options) {
keyStep: 120,
preventTouch: false,
unpreventTouchClass: 'vs-touchmove-allowed',
limitInertia: false
limitInertia: false,
useKeyboard: true,
useTouch: true
}, options);

if (this.options.limitInertia) this._lethargy = new Lethargy();
Expand Down Expand Up @@ -1373,7 +1377,7 @@ VirtualScroll.prototype._bind = function() {
if(support.hasWheelEvent) this.el.addEventListener('wheel', this._onWheel, this.listenerOptions);
if(support.hasMouseWheelEvent) this.el.addEventListener('mousewheel', this._onMouseWheel, this.listenerOptions);

if(support.hasTouch) {
if(support.hasTouch && this.options.useTouch) {
this.el.addEventListener('touchstart', this._onTouchStart, this.listenerOptions);
this.el.addEventListener('touchmove', this._onTouchMove, this.listenerOptions);
}
Expand All @@ -1385,7 +1389,7 @@ VirtualScroll.prototype._bind = function() {
this.el.addEventListener('MSPointerMove', this._onTouchMove, true);
}

if(support.hasKeyDown) document.addEventListener('keydown', this._onKeyDown);
if(support.hasKeyDown && this.options.useKeyboard) document.addEventListener('keydown', this._onKeyDown);
};

VirtualScroll.prototype._unbind = function() {
Expand All @@ -1403,7 +1407,7 @@ VirtualScroll.prototype._unbind = function() {
this.el.removeEventListener('MSPointerMove', this._onTouchMove, true);
}

if(support.hasKeyDown) document.removeEventListener('keydown', this._onKeyDown);
if(support.hasKeyDown && this.options.useKeyboard) document.removeEventListener('keydown', this._onKeyDown);
};

VirtualScroll.prototype.on = function(cb, ctx) {
Expand Down