egorkhmelev / jslider

jQuery Slider plugin (THIS PROJECT IS NOT MAINTAINED ANYMORE, READ BELOW FOR MORE INFO)
http://egorkhmelev.github.com/jslider
MIT License
507 stars 203 forks source link

Set "from" and "to" programmatically #65

Open biegl opened 11 years ago

biegl commented 11 years ago

Would be nice to have a function to set the from and to values after initialisation. The function should redraw the slider to adjust to the new settings.

johnraz commented 11 years ago

:+1:

Jaspur commented 11 years ago

Already works. See this:

http://url.dev/?price=150000;1478000
<input id="testprice" type="hidden" value="<?php if(isset($_GET['price'])){ echo $_GET['price']; }  ?>"/>
if( $('#testprice').val() != '' ){
                var value = $('#testprice').val();
        var price = value.split(';');
        var firstValue = price[0];
        var secondValue = price[1];
                $('#slider').slider('value', firstValue, secondValue); 
}
johnraz commented 11 years ago

@Jaspur, this will actually change the value of the slider not it's boundaries. We are talking boundaries here, hence the redraw.

Jaspur commented 11 years ago

https://github.com/egorkhmelev/jslider/pull/62

johnraz commented 11 years ago

@Jaspur: Yep, thats a first step toward a solution.