Bug Tracker

Opened 12 years ago

Closed 12 years ago

#1865 closed bug (fixed)

slider curValue ignores minValue

Reported by: nostrademons Owned by: paul
Priority: major Milestone: 1.2.2
Component: ui Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:

Description

With this test case:

<div id = "slider" class = "ui-slider-1">
<div id = "sliderThumb" class = "ui-slider-handle"></div>
</div>
<input id = "sliderVal" size = "4"/>
<script type = "text/javascript">
$(document).ready(function() {
    $('#slider').slider({
        minValue: 20,
        maxValue: 40,
        slide: function(e, ui) {
            $('#sliderVal').val(ui.slider.curValue);
        }
    });
});

The values assigned to the text field range from 0 to 20 instead of 20 to 40.

Change History (4)

comment:1 Changed 12 years ago by nostrademons

Changing line 237 of ui.slider.js from

this.curValue = (Math.round((m/p)*o.realValue));

to

this.curValue = o.minValue + (Math.round((m/p)*o.realValue));

seems to fix the problem.

comment:2 Changed 12 years ago by paul

Owner: set to paul
Status: newassigned

comment:3 Changed 12 years ago by nostrademons

After more investigation, this seems to be a documentation bug. The correct value is returned by ui.value and ui.values, but the documentation says to use ui.slider.curValue. The patch above breaks other things (notably, the values returned by ui.value and ui.values), so disregard it and fix the documentation so that people don't use the wrong interface.

comment:4 Changed 12 years ago by paul

Resolution: fixed
Status: assignedclosed

Sorry, this has been complete redone and is therefore fixed. Thanks.

Note: See TracTickets for help on using tickets.