diff options
author | Richard Worth <rdworth@gmail.com> | 2010-02-15 14:34:42 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2010-02-15 14:34:42 +0000 |
commit | d4154562ea663926bbd5bbc3bc345c27250aaeb9 (patch) | |
tree | 2eef18924e7b5253bdb59fd6e3d0255d23a5afb6 /ui/jquery.ui.slider.js | |
parent | c9177acec1015706e04d50160de789cb15a69887 (diff) | |
download | jquery-ui-d4154562ea663926bbd5bbc3bc345c27250aaeb9.tar.gz jquery-ui-d4154562ea663926bbd5bbc3bc345c27250aaeb9.zip |
Fixed #5178 - Slider's change event fires on slide
Diffstat (limited to 'ui/jquery.ui.slider.js')
-rw-r--r-- | ui/jquery.ui.slider.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index f60c551a1..be90cdb81 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -36,6 +36,7 @@ $.widget("ui.slider", $.ui.mouse, { var self = this, o = this.options; this._keySliding = false; + this._mouseSliding = false; this._animateOff = true; this._handleIndex = null; this._detectOrientation(); @@ -262,6 +263,7 @@ $.widget("ui.slider", $.ui.mouse, { } this._start(event, index); + this._mouseSliding = true; self._handleIndex = index; @@ -305,6 +307,7 @@ $.widget("ui.slider", $.ui.mouse, { _mouseStop: function(event) { this.handles.removeClass("ui-state-active"); + this._mouseSliding = false; this._stop(event, this._handleIndex); this._change(event, this._handleIndex); this._handleIndex = null; @@ -421,15 +424,17 @@ $.widget("ui.slider", $.ui.mouse, { }, _change: function(event, index) { - var uiHash = { - handle: this.handles[index], - value: this.value() - }; - if (this.options.values && this.options.values.length) { - uiHash.value = this.values(index); - uiHash.values = this.values(); + if (!this._keySliding && !this._mouseSliding) { + var uiHash = { + handle: this.handles[index], + value: this.value() + }; + if (this.options.values && this.options.values.length) { + uiHash.value = this.values(index); + uiHash.values = this.values(); + } + this._trigger("change", event, uiHash); } - this._trigger("change", event, uiHash); }, value: function(newValue) { |