mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
fixed #4391 - ui-state-hover, ui-state-active and disabled sliders
This commit is contained in:
parent
0c28f50dae
commit
fbb912524d
@ -77,10 +77,26 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
|
|||||||
this.handle = this.handles.eq(0);
|
this.handle = this.handles.eq(0);
|
||||||
|
|
||||||
this.handles.add(this.range).filter("a")
|
this.handles.add(this.range).filter("a")
|
||||||
.click(function(event) { event.preventDefault(); })
|
.click(function(event) {
|
||||||
.hover(function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); })
|
event.preventDefault();
|
||||||
.focus(function() { $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus'); })
|
})
|
||||||
.blur(function() { $(this).removeClass('ui-state-focus'); });
|
.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.handles.each(function(i) {
|
||||||
$(this).data("index.ui-slider-handle", i);
|
$(this).data("index.ui-slider-handle", i);
|
||||||
@ -415,6 +431,14 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
|
|||||||
$.widget.prototype._setData.apply(this, arguments);
|
$.widget.prototype._setData.apply(this, arguments);
|
||||||
|
|
||||||
switch (key) {
|
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':
|
case 'orientation':
|
||||||
|
|
||||||
this._detectOrientation();
|
this._detectOrientation();
|
||||||
|
Loading…
Reference in New Issue
Block a user