Bug Tracker

Modify

Ticket #1865 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

slider curValue ignores minValue

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

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

comment:1 Changed 6 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 6 years ago by paul

  • Owner set to paul
  • Status changed from new to assigned

comment:3 Changed 6 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 5 years ago by paul

  • Status changed from assigned to closed
  • Resolution set to fixed

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.