-
Notifications
You must be signed in to change notification settings - Fork 0
/
form_computation.js
106 lines (94 loc) · 2.86 KB
/
form_computation.js
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
const boxes = document.querySelectorAll('.output_labels');
function box(){
boxes.forEach(box => {
box.classList.add('animate');
setTimeout(() => {
box.classList.remove('animate');
}, 500);
});
}
const animateBtn = document.getElementById('submitBtn');
animateBtn.addEventListener('click', () => {
calculateResult(0);
sumResult(0);
box();
scrollTo(5000);
});
const animateBtn2 = document.getElementById('submitBtn2');
animateBtn2.addEventListener('click', () => {
calculateResult(1);
sumResult(1);
box();
scrollTo(5000);
});
const animateBtn3 = document.getElementById('submitBtn3');
animateBtn3.addEventListener('click', () => {
calculateResult(2);
sumResult(2);
box();
scrollTo(5000);
});
const numInput = document.getElementById("input4");
numInput.addEventListener("input", function() {
calculateResult(0);
box();
});
const numInput2 = document.getElementById("input8");
numInput2.addEventListener("input", function() {
calculateResult(1);
box();
});
const numInput3 = document.getElementById("input12");
numInput3.addEventListener("input", function() {
calculateResult(2);
box();
});
const numInput4 = document.getElementById("input1");
numInput4.addEventListener("input", function() {
calculateResult(0);
box();
});
const numInput5 = document.getElementById("input2");
numInput5.addEventListener("input", function() {
calculateResult(0);
box();
});
const numInput6 = document.getElementById("input3");
numInput6.addEventListener("input", function() {
calculateResult(0);
box();
});
const numInput7 = document.getElementById("input5");
numInput7.addEventListener("input", function() {
calculateResult(1);
box();
});
const numInput8 = document.getElementById("input6");
numInput8.addEventListener("input", function() {
calculateResult(1);
box();
});
const numInput9 = document.getElementById("input9");
numInput9.addEventListener("input", function() {
calculateResult(2);
box();
});
const numInput10 = document.getElementById("input10");
numInput10.addEventListener("input", function() {
calculateResult(2);
box();
});
const viewport = document.querySelector('meta[name="viewport"]');
const content = viewport.getAttribute('content');
viewport.setAttribute('content', `${content}, user-scalable=no`)
//system to convert large numbers to correct commas
function ntc(num) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function scrollTo(scrollPosition) {
window.scrollBy({
top: scrollPosition,
behavior: 'smooth'
});
}
//gutter cost by linear feet: $6.50 / ft <--make modular rate