-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
73 lines (58 loc) · 2.31 KB
/
script.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
// function doPopAll(First3, Mid3, Last4) {
// // This loop runs from 1 to 100
// for (let j = 1; j <= 100; j++) {
// // Create a variable to hold the formatted string value of j
// let formattedJ;
// // If j is less than 10, add a leading zero
// if (j < 10) {
// formattedJ = "0" + j.toString();
// }
// // Otherwise, convert j to a string
// else {
// formattedJ = j.toString();
// }
// // Get the form elements with ids "SearchXXa", "SearchXXb", and "SearchXXc"
// // where XX is the current value of formattedJ
// let first3ToPop = document.getElementById("Search" + formattedJ + "a");
// let mid3ToPop = document.getElementById("Search" + formattedJ + "b");
// let last4ToPop = document.getElementById("Search" + formattedJ + "c");
// // If the form elements exist, set their values to First3, Mid3, and Last4 respectively
// if (first3ToPop != null && mid3ToPop != null && last4ToPop != null) {
// first3ToPop.value = First3;
// mid3ToPop.value = Mid3;
// last4ToPop.value = Last4;
// }
// }
// }
function doPopAll(First3, Mid3, Last4) {
let phoneInputs = document.getElementsByClassName("phone-input");
for (let i = 0; i < phoneInputs.length; i += 3) {
let section = phoneInputs[i].getAttribute("data-section");
if (phoneInputs[i]) {
phoneInputs[i].value = First3;
}
if (phoneInputs[i + 1]) {
phoneInputs[i + 1].value = Mid3;
}
if (phoneInputs[i + 2]) {
phoneInputs[i + 2].value = Last4;
}
}
}
// This function displays hidden sections with class "advBackgroundSection" and scrolls the first one into view
function showAdvBackground() {
// Get all elements with class "advBackgroundSection"
const advBackgroundSections = document.getElementsByClassName("scale-up");
// Loop through each element and set the display property to "block"
for (const section of advBackgroundSections) {
section.style.display = "block";
// Use setTimeout to wait 50 milliseconds before adding the "visible" class to the section
setTimeout(function () {
section.classList.add("visible");
}, 50);
}
// Scroll the first section into view with a smooth animation
if (advBackgroundSections.length > 0) {
advBackgroundSections[0].scrollIntoView({ behavior: 'smooth' });
}
}