]> source.dussan.org Git - jquery-ui.git/commitdiff
Slider: Count the handles after setting up a range. Fixes #7922 - Slider with range...
authorDavid Petersen <public@petersendidit.com>
Tue, 16 Oct 2012 18:07:10 +0000 (14:07 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 18 Oct 2012 00:08:50 +0000 (20:08 -0400)
ui/jquery.ui.slider.js

index ab8287e7bf61538f07c03a3eca117b4550cc6d4b..eb0f7fc15ca68e1bb803bb5f175ca268a81235ce 100644 (file)
@@ -36,11 +36,10 @@ $.widget( "ui.slider", $.ui.mouse, {
        },
 
        _create: function() {
-               var i,
+               var i, handleCount,
                        o = this.options,
                        existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
                        handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
-                       handleCount = ( o.values && o.values.length ) || 1,
                        handles = [];
 
                this._keySliding = false;
@@ -79,6 +78,8 @@ $.widget( "ui.slider", $.ui.mouse, {
                                ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
                }
 
+               handleCount = ( o.values && o.values.length ) || 1;
+
                for ( i = existingHandles.length; i < handleCount; i++ ) {
                        handles.push( handle );
                }