From 7f59470ddd97c4c84c5bbbcbd1f4ed24af08166e Mon Sep 17 00:00:00 2001 From: Antonio Laguna Date: Thu, 27 Apr 2017 16:39:19 +0200 Subject: [PATCH] Adding option to disable scroll navigation Fixes #66 --- src/js/modules/webslides.js | 2 ++ src/js/plugins/scroll.js | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/js/modules/webslides.js b/src/js/modules/webslides.js index 5701fb4..1acf4cf 100644 --- a/src/js/modules/webslides.js +++ b/src/js/modules/webslides.js @@ -36,6 +36,7 @@ export default class WebSlides { * @param {boolean} loop Whether to go to first slide from last one or not. * @param {number} minWheelDelta Controls the amount of needed scroll to * trigger navigation. + * @param {boolean} navigateOnScroll Whether scroll can trigger navigation or not. * @param {number} scrollWait Controls the amount of time to wait till * navigation can occur again with scroll. * @param {number} slideOffset Controls the amount of needed touch delta to @@ -46,6 +47,7 @@ export default class WebSlides { changeOnClick = false, loop = true, minWheelDelta = 40, + navigateOnScroll = true, scrollWait = 450, slideOffset = 50 } = {}) { diff --git a/src/js/plugins/scroll.js b/src/js/plugins/scroll.js index b909683..1aa1aa8 100644 --- a/src/js/plugins/scroll.js +++ b/src/js/plugins/scroll.js @@ -40,6 +40,11 @@ export default class Scroll { */ this.timeout_ = null; + // Disabling from option + if (!this.ws_.options.navigateOnScroll) { + return; + } + if (!MobileDetector.isAny()) { this.scrollContainer_.addEventListener( 'wheel', this.onMouseWheel_.bind(this));