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, #amount3 {
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 price = {
30: {
30: 905,
40: 1095
},
40: {
30: 1095,
40: 1305,
60: 1730
},
50: {
50: 1755,
70: 2230
},
60: {
40: 1730,
60: 2255,
90: 3045
},
70: {
50: 2230,
70: 3000,
100: 3670
},
80: {
80: 3500,
120: 4655
},
90: {
60: 3045,
90: 4200
},
100: {
70: 3670,
100: 4755
},
120: {
80: 4655,
120: 6305
}
};
function comb(a) {
return Object.keys(a)
}
var steps = comb(price);
var num = steps[0];
var steps2 = comb(price[num]);
$("#slider2").slider({
value: 0,
min: 0,
max: steps2.length - 1,
step: 1,
slide: function(event, ui) {
var Y = steps2[ui.value];
$("#amount2").val(Y);
$("#amount3").val(price[num][Y]);
},
change: function(event, ui) {
var Y = steps2[ui.value];
$("#amount2").val(Y);
$("#amount3").val(price[num][Y]);
}
});
$("#slider").slider({
value: 0,
min: 0,
max: steps.length - 1,
step: 1,
slide: function(event, ui) {
num = steps[ui.value];
$("#amount").val(num);
steps2 = comb(price[num]);
$("#slider2").slider("option","max", steps2.length - 1);
$("#slider2").slider("option", "value", 0)
},
change: function(event, ui) {
num = steps[ui.value];
$("#amount").val(num);
steps2 = comb(price[num]);
$("#slider2").slider("option","max", steps2.length - 1);
$("#slider2").slider("option", "value", 0)
}
});
$("#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>
<p>
<input type="text" id="amount3" readonly>
</p>
</body>
</html>