jQuery: The Write Less, Do More JavaScript Library

Ticket #2053 (closed enhancement: fixed)

Opened 8 months ago

Last modified 5 months ago

ui.slider - Multiple sliders - moveTo function with startValues.

Reported by: jamez Assigned to: braeker
Type: enhancement Priority: major
Milestone: 1.2.2 Component: ui
Version: 1.2.1 Keywords:
Cc: Needs: Review

Description

I've modified ui.slider.js because I want to set the sliders to initial values and/or change the slider values via javascript.

Init example: $('#example3').slider({ steps: 10, startValues:[0,40] });

I know this was a planned/todo function (or rather modify the moveTo function) but you may find this helpful.

Lines 86, 138-142, 295-326 contain my changes.

Thanks.

Attachments

ui.slider.js (10.7 kB) - added by jamez 8 months ago.
ui.slider.js mod
ui-slider-startValue.patch (2.1 kB) - added by joern 5 months ago.
startvalue as array for multiple handles patch, requires #2500 to be fixed

Change History

Changed 8 months ago by jamez

ui.slider.js mod

Changed 5 months ago by braeker

  • owner set to braeker

Changed 5 months ago by joern

startvalue as array for multiple handles patch, requires #2500 to be fixed

Changed 5 months ago by joern

I've attached a (simpler?) patch that accepts an array for startValue. It also contains the code from the #2500 patch, as that is required, too, otherwise moveTo messes up string values.

Using this enhancement, its easy to initialize multiple handles with map, if your slide represents other input fields:

$(...).slide({
  startValue: $("#x, #y").map(function() { return this.value })
});

Changed 5 months ago by joern

  • status changed from new to closed
  • resolution set to fixed

Fixed in [4897].

Changed 5 months ago by joern

Updated the API. To set multiple start values, use the handles-option (see docs for details).

Note: See TracTickets for help on using tickets.