From 24afc68d5b4e2cca792980d41cef6f0a1e0fcdda Mon Sep 17 00:00:00 2001 From: Ca-Phun Ung Date: Fri, 26 Sep 2008 07:21:56 +0000 Subject: Spinner: added a timer to mousewheel interaction which fires a change event when the mousewheel stops spinning. Added a few missing options to test case. --- ui/ui.spinner.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/ui.spinner.js b/ui/ui.spinner.js index cbce210e8..8d81716d1 100644 --- a/ui/ui.spinner.js +++ b/ui/ui.spinner.js @@ -263,8 +263,14 @@ $.widget('ui.spinner', { (/[0-9\-\.]/).test(String.fromCharCode(e.keyCode))) ? true : false; }, _mousewheel: function(e, delta) { + var self = this; delta = ($.browser.opera ? -delta / Math.abs(delta) : delta); - (delta > 0 ? this._up(e) : this._down(e)); + (delta > 0 ? self._up(e) : self._down(e)); + if (self.timeout) { + window.clearTimeout(self.timeout); + self.timeout = 0; + } + self.timeout = window.setTimeout(function(){self._propagate('change', e)}, 500); e.preventDefault(); }, _getValue: function() { -- cgit v1.2.3