jQueryUI 1.8.14 Autocomplete
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/themes/black-tie/jquery-ui.css">
<div id="slider1"></div>
<input id="sliderValue1" />
<div id="boksTimer1"></div>
<div id="slider2"></div>
<input id="sliderValue2" />
<div id="boksTimer2"></div>
<div id="slider3"></div>
<input id="sliderValue3" />
<div id="boksTimer3"></div>
CSS
#sliderValue1, #sliderValue2, #sliderValue3 {
position:absolute;
width: 50px;
}
#slider1, #slider2, #slider3 {margin-left:100px;margin-top:100px;}
#boksTimer1, #boksTimer2, #boksTimer3 {width:20px;height:20px;font-family:arial;position:absolute;
width: 100px;font-size:11px;}
JavaScript
$(document).ready(function() {
$("#slider1").slider({
value: '',
min: 0,
max: 150,
step: 0.5,
range: 'min',
slide: function(event, ui) {
$("#amount").html(ui.value + ' timer');
$('#sliderValue').val(ui.value);
}
});
$("#slider2").slider({
value: '',
min: 0,
max: 150,
step: 0.5,
range: 'min',
slide: function(event, ui) {
$("#amount").html(ui.value + ' timer');
$('#sliderValue').val(ui.value);
}
});
$("#slider3").slider({
value: '',
min: 0,
max: 150,
step: 0.5,
range: 'min',
slide: function(event, ui) {
$("#amount").html(ui.value + ' timer');
$('#sliderValue').val(ui.value);
}
});
var $mainLabel = $('#boksTimer');
$('#slider1, #slider2, #slider3, #slider4, #slider5').bind('slide', function (event, ui)
{
var num = this.id.replace('slider','');
if(parseInt(num) == 1) {
$label = $('#boksTimer' + num).html( (ui.value / 31 * 60).toFixed(0) + ' GODT' );
}
elseif(parseInt(num) == 2) {
$label = $('#boksTimer' + num).html( (ui.value / 31 * 60).toFixed(0) + ' SUPER' );
}
else {
$label = $('#boksTimer' + num).html( (ui.value / 31 * 60).toFixed(0) + ' min pr. dag' );
}
$thumb = $(this).children('.ui-slider-handle');
$label.css({
top: $label.outerHeight(true),
left :$thumb.position().left - ( $label.width() - $thumb.width() ) / 2
});
});
});