From 5e44d9b372930b9dbce7a5b070c24d6c480be431 Mon Sep 17 00:00:00 2001 From: Kevin Sweeney Date: Mon, 20 Jun 2011 11:13:40 -0700 Subject: [PATCH] Scroll content when mousewheel event is fired over scroll track (mimic default scrollbar behavior) --- Source/Layout/MooScroller.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Layout/MooScroller.js b/Source/Layout/MooScroller.js index c498e2b..929187a 100644 --- a/Source/Layout/MooScroller.js +++ b/Source/Layout/MooScroller.js @@ -124,13 +124,19 @@ var MooScroller = new Class({ attach: function(){ this.knob.addEvent('mousedown', this.bound.start); - if (this.options.scrollSteps) this.content.addEvent('mousewheel', this.bound.wheel); + if (this.options.scrollSteps) { + this.content.addEvent('mousewheel', this.bound.wheel); + this.track.addEvent('mousewheel', this.bound.wheel); + } this.track.addEvent('mouseup', this.bound.page); }, detach: function(){ this.knob.removeEvent('mousedown', this.bound.start); - if (this.options.scrollSteps) this.content.removeEvent('mousewheel', this.bound.wheel); + if (this.options.scrollSteps) { + this.content.removeEvent('mousewheel', this.bound.wheel); + this.track.removeEvent('mousewheel', this.bound.wheel); + } this.track.removeEvent('mouseup', this.bound.page); document.id(document.body).removeEvent('mouseup', this.clearScroll); },