1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| $(function() {
var select1 = $( "#MensId" );
var select2 = $( "#DureId" );
tooltip1 = $("#indic1");
tooltip2 = $("#indic2");
tooltip1.hide();
tooltip2.hide();
$( "#slider2" ).slider({
range: 'min',
value:2,
min:1,
max:4,
step:0.01,
start: function(event,ui) {
tooltip1.fadeIn('fast');
tooltip2.fadeIn('fast');
},
slide: function( event, ui ) {
select1[ 0 ].selectedIndex = ui.value - 1;
select2[ 0 ].selectedIndex = ui.value - 1;
var pos = $('.ui-slider-handle:last').position();
tooltip1.css('left', pos.left-70 ).text($("#DureId > option:selected").text());
tooltip2.css('left', pos.left+50 ).text($("#MensId > option:selected").text());
},
stop: function(event,ui) {
tooltip1.fadeOut('fast');
tooltip2.fadeOut('fast');
},
});
select1.change(function() {
$( "#slider2").slider( "value", this.selectedIndex + 1 );
});
select2.change(function() {
$( "#slider2").slider( "value", this.selectedIndex + 1 );
}); |
Partager