Skip to content

add option to disable horizontal scrolling #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ <h2 id="config">
<td>
Boolean</td>
</tr>
<tr>
<td>
<code>horizMouseScroll</code></td>
<td>
<code>true</code></td>
<td>
<code>Indicates whether mousescroll controls the horizontal scrolling of the chart.</code></td>
</tr>
</tbody>
</table>

Expand Down
11 changes: 7 additions & 4 deletions js/jquery.fn.gantt.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
// navigation
navigate: "buttons",
scrollToToday: true,
horizMouseScroll: true,
// cookie options
useCookie: false,
cookieKey: "jquery.fn.gantt",
Expand Down Expand Up @@ -360,10 +361,12 @@
var dataPanel = $('<div class="dataPanel" style="width: ' + width + 'px;"/>');

// 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) {
Expand Down