Skip to content
Permalink
Browse files

Spinner: Ignore delta of 0 from triggered mousewheel event. Verified

that mousewheel scrolling actually works fine in IE6.
  • Loading branch information...
jzaefferer committed Feb 26, 2011
1 parent 9ac6bde commit 48f060ac25a805f8070a3ec5daf8be8e56d2b60b
Showing with 5 additions and 3 deletions.
  1. +3 −2 tests/unit/spinner/spinner_core.js
  2. +2 −1 ui/jquery.ui.spinner.js
@@ -120,14 +120,15 @@ test("mouse click on buttons", function() {
});

test("mouse wheel on input", function() {
expect(3);
expect(4);
stop();

var el = $("#spin").spinner();
equal(el.val(), 0);
el.trigger("mousewheel", 1);
equal(el.val(), 1);

// mousewheel handler uses a timeout, need to accomodate that
stop();
setTimeout(function() {
el.trigger("mousewheel", -1);
equal(el.val(), 0);
@@ -181,12 +181,13 @@ $.widget('ui.spinner', {
}
var self = this;
this.element.bind("mousewheel.spinner", function(event, delta) {
if (self.options.disabled) {
if (self.options.disabled || !delta) {
return;
}
if (!self.spinning && !self._start(event)) {
return false;
}
$("<div>").text("delta: " + delta).appendTo(document.body)
self._spin((delta > 0 ? 1 : -1) * self.options.step, event);
clearTimeout(self.timeout);
self.timeout = setTimeout(function() {

0 comments on commit 48f060a

Please sign in to comment.
You can’t perform that action at this time.