Skip to content
Permalink
Browse files

slider: range can now be toggled on-the-fly (fixes #3004)

  • Loading branch information
Paul Bakaus
Paul Bakaus committed Jun 26, 2008
1 parent 8ccab9a commit 6a6829db7f2e7223b34d0e21aa372f11eb271344
Showing with 10 additions and 0 deletions.
  1. +10 −0 ui/ui.slider.js
@@ -58,6 +58,11 @@ $.widget("ui.slider", {
if (/min|max|steps/.test(key)) {
this.initBoundaries();
}

if(key == "range") {
value ? this.handle.length == 2 && this.createRange() : this.removeRange();
}

},

init: function() {
@@ -200,12 +205,17 @@ $.widget("ui.slider", {


createRange: function() {
if(this.rangeElement) return;
this.rangeElement = $('<div></div>')
.addClass('ui-slider-range')
.css({ position: 'absolute' })
.appendTo(this.element);
this.updateRange();
},
removeRange: function() {
this.rangeElement.remove();
this.rangeElement = null;
},
updateRange: function() {
var prop = this.options.axis == "vertical" ? "top" : "left";
var size = this.options.axis == "vertical" ? "height" : "width";

0 comments on commit 6a6829d

Please sign in to comment.
You can’t perform that action at this time.