From c493d512dd36ed24c394e6d2f292266951c23fc4 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 9 May 2018 15:19:31 -0700 Subject: [PATCH] add option to disable horizontal scrolling --- index.html | 8 ++++++++ js/jquery.fn.gantt.js | 11 +++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 042c854..1a6dfc2 100644 --- a/index.html +++ b/index.html @@ -263,6 +263,14 @@

Boolean + + + horizMouseScroll + + true + + Indicates whether mousescroll controls the horizontal scrolling of the chart. + diff --git a/js/jquery.fn.gantt.js b/js/jquery.fn.gantt.js index c59cb63..0ecb7fe 100644 --- a/js/jquery.fn.gantt.js +++ b/js/jquery.fn.gantt.js @@ -183,6 +183,7 @@ // navigation navigate: "buttons", scrollToToday: true, + horizMouseScroll: true, // cookie options useCookie: false, cookieKey: "jquery.fn.gantt", @@ -360,10 +361,12 @@ var dataPanel = $('
'); // Handle mousewheel events for scrolling the data panel - var wheel = 'onwheel' in element ? - 'wheel' : document.onmousewheel !== undefined ? - 'mousewheel' : 'DOMMouseScroll'; - $(element).on(wheel, function (e) { core.wheelScroll(element, e); }); + if (settings.horizMouseScroll) { + var wheel = 'onwheel' in element ? + 'wheel' : document.onmousewheel !== undefined ? + 'mousewheel' : 'DOMMouseScroll'; + $(element).on(wheel, function (e) { core.wheelScroll(element, e); }); + } // Handle click events and dispatch to registered `onAddClick` function dataPanel.click(function (e) {