aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.slider.js
diff options
context:
space:
mode:
authorRichard Worth <rdworth@gmail.com>2009-04-02 00:10:52 +0000
committerRichard Worth <rdworth@gmail.com>2009-04-02 00:10:52 +0000
commitfbb912524dd61e56fe3824483396b666ac3a3a13 (patch)
treeac41d693befbb6952564ec14db358dbe9cab1693 /ui/ui.slider.js
parent0c28f50daef533a02b79f5ad40d3ba10e3ad4b54 (diff)
downloadjquery-ui-fbb912524dd61e56fe3824483396b666ac3a3a13.tar.gz
jquery-ui-fbb912524dd61e56fe3824483396b666ac3a3a13.zip
fixed #4391 - ui-state-hover, ui-state-active and disabled sliders
Diffstat (limited to 'ui/ui.slider.js')
-rw-r--r--ui/ui.slider.js32
1 files changed, 28 insertions, 4 deletions
diff --git a/ui/ui.slider.js b/ui/ui.slider.js
index 43cfd3b27..2eee4f2d8 100644
--- a/ui/ui.slider.js
+++ b/ui/ui.slider.js
@@ -77,10 +77,26 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
this.handle = this.handles.eq(0);
this.handles.add(this.range).filter("a")
- .click(function(event) { event.preventDefault(); })
- .hover(function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); })
- .focus(function() { $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus'); })
- .blur(function() { $(this).removeClass('ui-state-focus'); });
+ .click(function(event) {
+ event.preventDefault();
+ })
+ .hover(function() {
+ if (!o.disabled) {
+ $(this).addClass('ui-state-hover');
+ }
+ }, function() {
+ $(this).removeClass('ui-state-hover');
+ })
+ .focus(function() {
+ if (!o.disabled) {
+ $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus');
+ } else {
+ $(this).blur();
+ }
+ })
+ .blur(function() {
+ $(this).removeClass('ui-state-focus');
+ });
this.handles.each(function(i) {
$(this).data("index.ui-slider-handle", i);
@@ -415,6 +431,14 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
$.widget.prototype._setData.apply(this, arguments);
switch (key) {
+ case 'disabled':
+ if (value) {
+ this.handles.filter(".ui-state-focus").blur();
+ this.handles.removeClass("ui-state-hover");
+ this.handles.attr("disabled", "disabled");
+ } else {
+ this.handles.removeAttr("disabled");
+ }
case 'orientation':
this._detectOrientation();