<meta charset="utf-8">
<title>jQuery UI Slider - Range slider</title>
<link rel="stylesheet" href="jquery.ui.all.css">
<script src="jquery-1.7.1.js"></script>
<script src="jquery.ui.widget.js"></script>
<script src="jquery.ui.mouse.js"></script>
<script src="jquery.ui.slider.js"></script>
<link rel="stylesheet" href="demos.css">
<script>
$(function() {
$( "#slider-range" ).slider({
range: true,
min: 0,
max: 500,
values: [ 75, 300 ],
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
}
});
$( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
" - $" + $( "#slider-range" ).slider( "values", 1 ) );
$( "#minValue" ).val( ui.values[ 0 ] );
$( "#maxValue" ).val( ui.values[ 1 ] );
});
</script>
<div class="demo">
<p>
<label for="amount">Price range:</label>
<input type="text" id="amount" name ="amount" style="border:0; color:#f6931f; font-weight:bold;"/>
</p>
<div id="slider-range"></div>
<input type="hidden" id="minValue" name="minValue" value="<?php echo (isset($_POST['minValue'])) ? $_POST['minValue'] : '75'; ?>" />
<input type="hidden" id="maxValue" name="maxValue" value="<?php echo (isset($_POST['maxValue'])) ? $_POST['maxValue'] : '300'; ?>" />
</div><!-- End demo -->
- How I can get the min & max values?
- When slider sliding how do I read that values from this code?
- Is there any function is needed for reading the min & max values?
Assuming you have used every thing correctly i am answering your questions.
1)How I can get the min & max values.
Answer: to get min and max values you can use the values array which is declared as a default option in the plugin.
ui.values[ 0 ]in slide function will give you min values andui.values[ 1 ]will give you max value.2)when slider sliding how I read that values from this code;
Answer: when slider is sliding the slide function is executed so the code block which is inside the slide function will automatically give you the desired result.
3)Is there any function is needed for reading the min & max values
Answer: No there is no function for reading min and max values, this can be achieved in slide function and values is the parameter for calling the slider function.