forked from kokonior/CSS-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.html
More file actions
373 lines (351 loc) · 13.2 KB
/
calc.html
File metadata and controls
373 lines (351 loc) · 13.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<!DOCTYPE html>
<html>
<head>
<meta content='L9S5bDgqWZyQf7SCMUF6' name='follow_it-verification-code'/>
<link href='https://1.bp.blogspot.com' rel='preconnect'/>
<link href='https://adservice.google.com' rel='preconnect'/>
<link href='https://googleads.g.doubleclick.net' rel='preconnect'/>
<link href='https://www.google-analytics.com' rel='preconnect'/>
<link href='https://fonts.gstatic.com' rel='dns-prefetch'/>
<link href='https://1.bp.blogspot.com' rel='dns-prefetch'/>
<link href='https://pagead2.googlesyndication.com' rel='dns-prefetch'/>
<link href='https://cdnjs.cloudflare.com' rel='dns-prefetch'/>
<link href='https://adservice.google.com' rel='dns-prefetch'/>
<link href='https://googleads.g.doubleclick.net' rel='dns-prefetch'/>
<link href='https://www.google-analytics.com' rel='dns-prefetch'/>
<link href='https://www.googletagservices.com' rel='preconnect'/>
<link href='https://www.googletagservices.com' rel='dns-prefetch'/>
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css' rel='stylesheet'/>
<title>Lease Calculator ZAsset Finance</title>
<meta content="width=device-width, initial-scale=1" name="viewport" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css">
<style type="text/css">
.main_section{
margin:.9375rem 10%;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
.c-calculatorarea .c-calculate-slider .c-input label {
font-weight: 600;
}
.c-calculatorarea .c-calculate-slider .e-noie {
margin: 0;
width: 45%;
margin-top: .875rem;
}
input[type=range] {
-webkit-appearance: none;
margin: 10px 0;
width: 100%;
background: #2e50f785;
border-radius:0%;
height: 3px;
}
input[type=range]::-webkit-slider-thumb{
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #2e50f7;
cursor: pointer;
}
input[type=range]::-moz-range-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #2e50f7;
cursor: pointer;
}
input {
line-height: normal;
}
.c-calculatorarea .c-calculate-slider .form-control {
width: 45%;
margin: 0 3%;
height: 2.1875rem;
padding-left: .625rem;
float: right;
}
.c-resulttitle{
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
font-size: 18px;
margin-top: 15px;
}
input[type="text"]{
border: none;
border-bottom:2px solid #2e50f7;
border-radius: 0;
margin-top: -16px !important;
margin-bottom: 16px !important;
}
.c-calculatorarea .c-resultbox .c-resultlabel {
font-weight: 700;
font-size: 1.875rem;
margin-left: .625rem;
text-align: center;
}
.c-btn{
background-color: transparent;
border-radius: 3px;
border: 1px solid #2e50f7;
color: #2e50f7;
cursor: pointer;
display: inline-block;
font-family: Open Sans,sans-serif;
font-size: .8125rem;
font-weight: 600;
line-height: 1;
min-width: 8.75rem;
padding: .75rem 1.125rem;
position: relative;
text-align: center;
text-decoration: none;
text-shadow: none!important;
text-transform: uppercase;
}
.c-btn.active{
background: #2e50f7;
color: #fff;
}
#c-calculate-monthly {
margin: 10px 0px;
}
.c-resultbox{
width: 50%;
}
.c-calculate-slider{
width: 50%;
}
.footer__text{
width: 70%;
padding: 25px 0;
padding-bottom: 10px;
display: block;
margin: 0 auto;
}
.footer__text p{
margin:0;
text-align: center;
}
.main__head{
margin-bottom: 15px;
}
.main__head h1{
font-size: 32px;
text-align: center;
}
@media screen and (max-width: 768px) {
.c-calculatorarea{
flex-direction: column;
}
.c-resultbox{
width: 100%;
}
.c-calculate-slider{
width: 100%;
}
.footer__text{
width: 100%;
}
}
@media screen and (max-width: 500px) {
.c-calculatorarea .c-calculate-slider .e-noie{
width: 100%;
}
.main__head h1{
font-size: 24px;
}
.c-calculatorarea .c-calculate-slider .form-control{
width: 100%;
float: left;
margin: 15px 0;
}
input[type="text"]{
margin-top: 10px !important;
}
}
</style>
</head>
<body>
<section class="main_section">
<div class="o-grid">
<div class="o-content-wrap p-2">
<div>
<div class="main__head">
<h1>Calculate your Repayment</h1>
</div>
<div class="c-calculatorarea d-flex w-100 clearfix">
<div class="c-calculate-slider">
<div class="c-input clearfix">
<label for="c-amount-text">Amount</label>
<label for="c-amount-slider" class="sr-only">Amount Range</label>
<br>
<input id="c-amount-slider" class="e-noie" type="range" data-min="5000" data-max="100000" min="5000" max="100000" step="1" value="25000">
<input id="c-amount-text" class="form-control" type="text" value="25000">
<span class="c-form-error amount-error" style="display: none;">
<ul class="parsley-errors-list filled">
<li class="parsley-required"> </li>
</ul>
</span>
</div>
<div class="c-input clearfix">
<label for="c-term-text">Term (months)</label>
<label for="c-term-slider" class="sr-only">Terms Range</label>
<br>
<input id="c-term-slider" class="e-noie" type="range" data-min="12" data-max="84" min="12" max="84" step="1" value="60">
<input id="c-term-text" class="form-control" type="text" value="60">
<span class="c-form-error term-error" style="display: none;">
<ul class="parsley-errors-list filled">
<li class="parsley-required"> </li>
</ul>
</span>
</div>
<div class="c-input clearfix">
<label for="c-rate-text">Rate</label>
<label for="c-rate-slider" class="sr-only">Rate Range</label>
<br>
<input id="c-rate-slider" class="e-noie" type="range" data-min="4" data-max="18" min="4" max="18" step="0.1" value="5.99">
<input id="c-rate-text" class="form-control" type="text" value="5.99%">
<span class="c-form-error rate-error" style="display: none;">
<ul class="parsley-errors-list filled">
<li class="parsley-required"> </li>
</ul>
</span>
</div>
</div>
<div class="c-resultbox">
<div class="u-spacing-bottom-base">
<div id="c-resulttitle" class="c-resulttitle">
Your estimated
<span id="duration-label">monthly</span>
repayment
</div>
<div id="c-calculator-result" class="c-resultlabel">$483</div>
</div>
<div class="">
<div class="btn-group btn-group-sm c-resulttype" style="display: flex;flex-direction: column;align-items: center;justify-content: center;" role="group">
<button id="c-calculate-monthly" type="button" data-label="monthly" class="c-btn active">Monthly</button>
<button id="c-calculate-fortnightly" type="button" data-label="fortnightly" class="c-btn ">Fortnightly</button>
</div>
</div>
</div>
</div>
<div></div>
<div class="footer__text">
<p>* Quotes are an indication of the payment for the amount of finance specificed. The quotes are subject to commercial lending criteria with a completed credit assessment and are subject to change.</p>
</div>
</div>
</div>
</div>
</section>
</body>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js"></script>
<script
src="https://code.jquery.com/jquery-3.6.0.js"
integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk="
crossorigin="anonymous"></script>
<script type="text/javascript">
let amountSlider = document.getElementById("c-amount-slider");
let termSlider = document.getElementById("c-term-slider");
let rateSlider = document.getElementById("c-rate-slider");
let amountIn = document.getElementById("c-amount-text");
let termIn = document.getElementById("c-term-text");
let rateIn = document.getElementById("c-rate-text");
let monthCalc = document.getElementById("c-calculate-monthly");
let foreCalc = document.getElementById("c-calculate-fortnightly");
let changeText = document.getElementById("duration-label");
let result = document.getElementById("c-calculator-result");
amountSlider.oninput = function() {
amountIn.value = this.value;
}
amountIn.oninput = function() {
amountSlider.value = this.value;
}
termSlider.oninput = function() {
termIn.value = this.value;
}
termIn.oninput = function() {
termSlider.value = this.value;
}
rateSlider.oninput = function() {
rateIn.value = this.value;
}
rateIn.oninput = function() {
rateSlider.value = this.value;
}
monthCalc.onclick = function() {
if (foreCalc.classList.contains("active")) {
foreCalc.classList.remove("active");
}
monthCalc.classList.add("active");
if (changeText.innerHTML === "fortnightly") {
changeText.innerHTML = "monthly";
}
let monInt = parseFloat(rateIn.value) / 1200;
let months = parseInt(termIn.value);
let amount = parseInt(amountIn.value);
let calculation = ((monInt + (monInt / (Math.pow((1 + monInt), months) -1))) * (amount)).toFixed(2);
result.innerHTML = "$" + calculation;
}
foreCalc.onclick = function() {
if (monthCalc.classList.contains("active")) {
monthCalc.classList.remove("active");
}
foreCalc.classList.add("active");
if (changeText.innerHTML === "monthly") {
changeText.innerHTML = "fortnightly";
}
let monInt = parseFloat(rateIn.value) / 2607;
let months = parseFloat(termIn.value*2.173);
let amount = parseInt(amountIn.value);
let calculation = ((monInt + (monInt / (Math.pow((1 + monInt), months) -1))) * (amount)).toFixed(2);
result.innerHTML = "$" + calculation;
}
// amountIn.onchange = function (){
// if (monthCalc.classList.contains("active")) {
// let monInt = parseFloat(rateIn.value) / 1200;
// let months = parseInt(termIn.value);
// let amount = parseInt(amountIn.value);
// let calculation = ((monInt + (monInt / (Math.pow((1 + monInt), months) -1))) * (amount)).toFixed(2);
// console.log(calculation);
// console.log(monInt);
// console.log(months);
// console.log(amount);
// }
// }
$('.c-input input').change(function(){
if (monthCalc.classList.contains("active")) {
let monInt = parseFloat(rateIn.value) / 1200;
let months = parseInt(termIn.value);
let amount = parseInt(amountIn.value);
let calculation = ((monInt + (monInt / (Math.pow((1 + monInt), months) -1))) * (amount)).toFixed(2);
result.innerHTML = "$" + calculation;
}else {
let monInt = parseFloat(rateIn.value) / 2607;
let months = parseFloat(termIn.value*2.173);
let amount = parseInt(amountIn.value);
let calculation = ((monInt + (monInt / (Math.pow((1 + monInt), months) -1))) * (amount)).toFixed(2);
// console.log(calculation);
// console.log(monInt);
// console.log(months);
// console.log(amount);
result.innerHTML = "$" + calculation;
}
})
// calculation = ((monInt + (monInt / (Math.pow((1 + monInt), months) -1))) * (amount - (down || 0))).toFixed(2);
</script>
</html>