I have successfully placed multiple jquery ui slider on a page and its transalation text too. you can check it live on: http://outsourcingnepal.com/projects/jQuery%20slider/
I have my jquery code as :
var arrLabel1 = new Array('Not Good', 'OK', 'Average', 'Above Average', 'Excellent', 'Outstanding');
$(function() {
$( ".slider_control" ).slider({
value:0,
min: 0,
max: 5,
step: 1,
slide: function( event, ui ) {
$( "#slider_" + $(this).attr('rel') ).val( ui.value );
$( "#label_" + $(this).attr('rel') ).text( arrLabel1[ ui.value ] );
}
}).each(function(index){
$( "#slider_" + (index + 1) ).val( $( this ).slider( "value" ) );
$( "#label_" + (index + 1) ).text( arrLabel1[ $(this).slider( "value" ) ] );
});
});
Now i would like to optimize it so that i can be independent of rel attribute.
MY HTML:
<ul class="slider-container">
<li class="ui_slider">
<div class="title">Overall: <span id="label_1"></span></div>
<input type="hidden" name="overall_review" id="slider_1" />
<div class="slider_control" rel="1"></div>
</li>
<li class="ui_slider">
<div class="title">Cleanliness: <span id="label_2"></span></div>
<input type="hidden" name="overall_review" id="slider_2" />
<div class="slider_control" rel="2"></div>
</li>
<li class="ui_slider">
<div class="title">Facilities: <span id="label_3"></span></div>
<input type="hidden" name="overall_review" id="slider_3" />
<div class="slider_control" rel="3"></div>
</li>
<li class="ui_slider">
<div class="title">Location: <span id="label_4"></span></div>
<input type="hidden" name="overall_review" id="slider_4" />
<div class="slider_control" rel="4"></div>
</li>
<li class="ui_slider">
<div class="title">Quality of Service: <span id="label_5"></span></div>
<input type="hidden" name="overall_review" id="slider_5" />
<div class="slider_control" rel="5"></div>
</li>
<li class="ui_slider">
<div class="title">Room: <span id="label_6"></span></div>
<input type="hidden" name="overall_review" id="slider_6" />
<div class="slider_control" rel="6"></div>
</li>
<li class="ui_slider">
<div class="title">Value of Money: <span id="label_7"></span></div>
<input type="hidden" name="overall_review" id="slider_7" />
<div class="slider_control" rel="7"></div>
</li>
</ul>