Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1820 from interactivellama/spinbox-scroll
Browse files Browse the repository at this point in the history
Remove spinbox mouse scrolling functionality
  • Loading branch information
swilliamset committed May 25, 2016
2 parents 63b776e + 78d52df commit 03397f6
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions js/spinbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
this.$element.on('keydown.fu.spinbox', this.$input, $.proxy(this.keydown, this));
this.$element.on('keyup.fu.spinbox', this.$input, $.proxy(this.keyup, this));

this.bindMousewheelListeners();
this.mousewheelTimeout = {};

if (this.options.hold) {
this.$element.on('mousedown.fu.spinbox', '.spinbox-up', $.proxy(function () {
this.startSpin(true);
Expand Down Expand Up @@ -356,47 +353,8 @@
if (keyCode === 38 || keyCode === 40) {
this.triggerChangedEvent();
}
},

bindMousewheelListeners: function bindMousewheelListeners() {
var inputEl = this.$input.get(0);
if (inputEl.addEventListener) {
//IE 9, Chrome, Safari, Opera
inputEl.addEventListener('mousewheel', $.proxy(this.mousewheelHandler, this), false);
// Firefox
inputEl.addEventListener('DOMMouseScroll', $.proxy(this.mousewheelHandler, this), false);
} else {
// IE <9
inputEl.attachEvent('onmousewheel', $.proxy(this.mousewheelHandler, this));
}
},

mousewheelHandler: function mousewheelHandler(event) {
if (!this.options.disabled) {
var e = window.event || event;// old IE support
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
var self = this;

clearTimeout(this.mousewheelTimeout);
this.mousewheelTimeout = setTimeout(function () {
self.triggerChangedEvent();
}, 300);

if (delta < 0) {
this.step(true);
} else {
this.step(false);
}

if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}

return false;
}
}

};


Expand Down

0 comments on commit 03397f6

Please sign in to comment.