1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-28 23:41:48 +02:00

Adding option to disable scroll navigation

Fixes #66
This commit is contained in:
Antonio Laguna
2017-04-27 16:39:19 +02:00
parent 8b8dfb3c16
commit 7f59470ddd
2 changed files with 7 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ export default class WebSlides {
* @param {boolean} loop Whether to go to first slide from last one or not. * @param {boolean} loop Whether to go to first slide from last one or not.
* @param {number} minWheelDelta Controls the amount of needed scroll to * @param {number} minWheelDelta Controls the amount of needed scroll to
* trigger navigation. * trigger navigation.
* @param {boolean} navigateOnScroll Whether scroll can trigger navigation or not.
* @param {number} scrollWait Controls the amount of time to wait till * @param {number} scrollWait Controls the amount of time to wait till
* navigation can occur again with scroll. * navigation can occur again with scroll.
* @param {number} slideOffset Controls the amount of needed touch delta to * @param {number} slideOffset Controls the amount of needed touch delta to
@@ -46,6 +47,7 @@ export default class WebSlides {
changeOnClick = false, changeOnClick = false,
loop = true, loop = true,
minWheelDelta = 40, minWheelDelta = 40,
navigateOnScroll = true,
scrollWait = 450, scrollWait = 450,
slideOffset = 50 slideOffset = 50
} = {}) { } = {}) {

View File

@@ -40,6 +40,11 @@ export default class Scroll {
*/ */
this.timeout_ = null; this.timeout_ = null;
// Disabling from option
if (!this.ws_.options.navigateOnScroll) {
return;
}
if (!MobileDetector.isAny()) { if (!MobileDetector.isAny()) {
this.scrollContainer_.addEventListener( this.scrollContainer_.addEventListener(
'wheel', this.onMouseWheel_.bind(this)); 'wheel', this.onMouseWheel_.bind(this));