diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-25 18:23:18 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-25 19:16:45 (GMT) |
commit | 534d3288e9b58f8351ed915790452d9bfdef9860 (patch) | |
tree | d7bef16763dff7105716a1c6010094f2aa136d9c | |
parent | 725acfe74356e46580dcc727b0f799d3e3ec3e06 (diff) |
added mouse wheel support to scroll weeks
-rw-r--r-- | www/js/calendar.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/www/js/calendar.js b/www/js/calendar.js index 7f8696a..815c5d9 100644 --- a/www/js/calendar.js +++ b/www/js/calendar.js @@ -95,6 +95,7 @@ function calendar_init() { $('#btn-today').click(calendar_today); $('#btn-earlier').click(calendar_prev); $('#btn-later').click(calendar_next); + $('#calendar').on('wheel', calendar_scroll); current_week_offset = -4; clock.addCallback(function() { calendar_redraw(current_week_offset); @@ -115,3 +116,17 @@ function calendar_next() { current_week_offset++; calendar_redraw(current_week_offset) } + +function calendar_scroll(event) { + console.log(event.originalEvent.deltaY); + if(event.originalEvent.deltaY > 0) { + calendar_next(); + return false + } + + if(event.originalEvent.deltaY < 0) { + calendar_prev(); + return false + } + return false; +} |