diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-06-26 11:08:52 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-06-26 11:08:52 +0000 |
commit | 6a6829db7f2e7223b34d0e21aa372f11eb271344 (patch) | |
tree | b9dcd54226cc6824861926e9ee6989c012410294 /ui/ui.slider.js | |
parent | 8ccab9a11f746d7766834ac8387b8733969bff2b (diff) | |
download | jquery-ui-6a6829db7f2e7223b34d0e21aa372f11eb271344.tar.gz jquery-ui-6a6829db7f2e7223b34d0e21aa372f11eb271344.zip |
slider: range can now be toggled on-the-fly (fixes #3004)
Diffstat (limited to 'ui/ui.slider.js')
-rw-r--r-- | ui/ui.slider.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/ui.slider.js b/ui/ui.slider.js index ad15cc04b..72135403d 100644 --- a/ui/ui.slider.js +++ b/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"; |