Yu.Ka.,
$(function() {
var range = [5E4, 12];
$("#slider-range-max").slider({
range: "max",
min: 5E4,
max: 5E6,
value: 5E4,
step: 5E4,
slide: function(event, ui) {
$("#amount").val(("" + ui.value).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, "$1 "));
range[0] = +ui.value;
calc()
},
change: function(event, ui) {
$("#amount").val(("" + ui.value).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, "$1 "));
range[0] = +ui.value;
calc()
}
});
$("#slider-range-max2").slider({
range: "max",
min: 6,
max: 48,
value: 12,
slide: function(event, ui) {
$("#amount2").val(ui.value);
range[1] = +ui.value;
calc()
},
change: function(event, ui) {
$("#amount2").val(ui.value);
range[1] = +ui.value;
calc()
}
});
$("#slider-range-max").slider("option", "value", 5E4);
$("#slider-range-max2").slider("option", "value", 12);
function calc(par) {
var summ = (range[0] + .01 * range[0] * range[1]) / range[1],
summ2 = range[0] + .01 * range[0] * range[1];
summ = summ.toFixed(0);
summ2 = summ2.toFixed(0);
summ = summ.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, "$1 ");
summ2 = summ2.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, "$1 ");
document.getElementById("summ").innerHTML = summ;
document.getElementById("summ2").innerHTML = summ2;
return false
}
});