<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Slider - Snap to increments</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
var Ij;
var arr = [
'Добавка к 0С',
'Добавка к 10С',
'Добавка к 20С',
'Добавка к 30С',
'Добавка к 40С'
];
$(function() {
$( "#slider" ).slider({
value:10,
min: 0,
max: 40,
step: 10,
slide: function( event, ui ) {
Ij=ui.value/10;
$( "#amount" ).val( ui.value + "C" +" " +arr[Ij] );
}
});
$( "#amount" ).val( $( "#slider" ).slider( "value" ) + "C" +" " +arr[$( "#slider" ).slider( "value" ) /10] );
});
</script>
</head>
<body>
<p>
<label for="amount">Диапазон температур:</label>
<input type="text" id="amount" style="border: 0; color: #f6931f; font-weight: bold;" />
</p>
<div id="slider"></div>
</body>
</html>