-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
80 lines (65 loc) · 2.7 KB
/
script.js
File metadata and controls
80 lines (65 loc) · 2.7 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
let currentStep = 1;
function updateProgress() {
const steps = document.querySelectorAll('.step');
const progressFill = document.getElementById('progressFill');
steps.forEach((step, index) => {
const stepNum = index + 1;
step.classList.remove('active', 'completed');
if (stepNum < currentStep) {
step.classList.add('completed');
} else if (stepNum === currentStep) {
step.classList.add('active');
}
});
const progressPercent = ((currentStep - 1) / (steps.length - 1)) * 100;
progressFill.style.width = progressPercent + '%';
}
function showStep(step) {
document.querySelectorAll('.step-content').forEach(content => {
content.classList.remove('active');
});
document.getElementById('step' + step).classList.add('active');
currentStep = step;
updateProgress();
window.scrollTo({ top: 0, behavior: 'smooth' });
}
function nextStep() {
if (currentStep < 3) {
showStep(currentStep + 1);
}
}
function previousStep() {
if (currentStep > 1) {
showStep(currentStep - 1);
}
}
function validateAndNext() {
const form = document.getElementById('applicationForm');
if (form.checkValidity()) {
nextStep();
} else {
form.reportValidity();
}
}
document.getElementById('termsAgree').addEventListener('change', function() {
document.getElementById('submitBtn').disabled = !this.checked;
});
function submitApplication() {
const termsChecked = document.getElementById('termsAgree').checked;
if (!termsChecked) {
alert('Please agree to the terms and conditions to proceed.');
return;
}
document.querySelectorAll('.step-content').forEach(content => {
content.classList.remove('active');
});
document.getElementById('success').classList.add('active');
const steps = document.querySelectorAll('.step');
steps.forEach(step => {
step.classList.remove('active');
step.classList.add('completed');
});
document.getElementById('progressFill').style.width = '100%';
window.scrollTo({ top: 0, behavior: 'smooth' });
}
updateProgress();