我正在尝试使用 3 个 jquery-ui 滑块进行贷款计算。
参数是:
借入金额
期限/还款月数
利率
在更改滑块时,我想显示以下值:
每月金额+利率
(贷款金额/月数=结果+(结果*利率))贷款总额+总利率。
(贷款总额+(贷款总额*利率))
目前我只有滑块,但我还没有设法将它们连接在一起来计算和显示这些值。非常感谢您的帮助。
这是一个小提琴
http://jsfiddle.net/L65u9spv/
Javascript:
$(function() {
$( "#slider-toloan" ).slider({
range: "min",
value: 25000,
min: 5000,
max: 400000,
step: 5000,
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.value );
}
});
$( "#amount" ).val( "$" + $( "#slider-toloan" ).slider( "value" ) );
$( "#slider-loanduration" ).slider({
range: "min",
value: 5,
min: 1,
max: 25,
step: 1,
slide: function( event, ui ) {
$( "#duration" ).val( ui.value );
}
});
$( "#duration" ).val( $( "#slider-loanduration" ).slider( "value" ) );
$( "#slider-rate" ).slider({
range: "min",
value: 1.85,
min: 1.75,
max: 23,
step: 0.05,
slide: function( event, ui ) {
$( "#rate" ).val( ui.value );
}
});
$( "#rate" ).val( $( "#slider-rate" ).slider( "value" ) );
});
html:
<p>
<label for="amount">Amount to Loan:</label>
<input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>
<div id="slider-toloan"></div>
<p>
<label for="duration">Duration Months:</label>
<input type="text" id="duration" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>
<div id="slider-loanduration"></div>
<p>
<label for="rate">Interest Rate</label>
<input type="text" id="rate" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>
<div id="slider-rate"></div>
<br /><br />
<p>To pay monthly (interest rate included): ?</p>
<span style="font-size:11px;">amount to loan / amount of months = result + (result * interest rate) </span>
<br />
<p>Total amount to pay all months (interest rate included): ?</p>
<span style="font-size:11px;">Total loan amount + (total loan amount * interest rate)</span>