fos,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
body {
font-family: sans-serif;
font-size: 12px;
}
#amount, #amount2 {
font-size: 22px;
font-weight: bold;
border:none;
color: #ff5555;
background: none;
}
#slider, #slider2{
width: 300px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js">
</script>
<script>
$(function() {
var steps = [30, 40, 50, 60, 70, 80, 90, 100, 120, 150];
function comb(a) {
return steps.filter(function(b, i) {
return i < a + 2 && i > a - 2
})
}
var steps2 = comb(0);
$("#slider2").slider({
value: 0,
min: 0,
max: steps2.length - 1,
step: 1,
slide: function(event, ui) {
$("#amount2").val(steps2[ui.value])
},
change: function(event, ui) {
$("#amount2").val(steps2[ui.value])
}
});
$("#slider").slider({
value: 0,
min: 0,
max: steps.length - 1,
step: 1,
slide: function(event, ui) {
$("#amount").val(steps[ui.value]);
steps2 = comb(ui.value);
$("#slider2").slider("option",
"max", steps2.length - 1);
$("#slider2").slider("option", "value", steps2.indexOf(steps[ui.value]))
},
change: function(event, ui) {
$("#amount").val(steps[ui.value]);
steps2 = comb(ui.value);
$("#slider2").slider("option", "max", steps2.length - 1);
$("#slider2").slider("option", "value", steps2.indexOf(steps[ui.value]))
}
});
$("#slider").slider("option", "value", 0)
});
</script>
</head>
<body>
<p>
<input type="text" id="amount" readonly>
</p>
<div id="slider"></div>
<p>
<input type="text" id="amount2" readonly>
</p>
<div id="slider2"></div>
</body>
</html>