-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathomr_home.js
154 lines (122 loc) · 4.51 KB
/
omr_home.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
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
// Function for Stages Slider
const prevBtn = document.querySelector('.prev-btn');
const nextBtn = document.querySelector('.next-btn');
const sliderContainer = document.querySelector('.slider-container');
const items = document.querySelectorAll('.slider-item');
const itemCount = items.length;
let currentIndex = 0;
function updateSlider() {
const itemWidth = items[0].clientWidth;
sliderContainer.style.transform = `translateX(-${currentIndex * itemWidth}px)`;
// Show/Hide buttons based on the current index
if (currentIndex === 0) {
prevBtn.style.display = 'none';
} else {
prevBtn.style.display = 'block';
}
if (currentIndex === itemCount - 1) {
nextBtn.style.display = 'none';
} else {
nextBtn.style.display = 'block';
}
// Ensure buttons are hidden when all slides are visible
const totalWidth = itemWidth * itemCount;
const visibleWidth = sliderContainer.parentElement.clientWidth;
if (visibleWidth >= totalWidth) {
prevBtn.style.display = 'none';
nextBtn.style.display = 'none';
}
}
prevBtn.addEventListener('click', () => {
currentIndex = (currentIndex - 1 + itemCount) % itemCount;
updateSlider();
});
nextBtn.addEventListener('click', () => {
currentIndex = (currentIndex + 1) % itemCount;
updateSlider();
});
// Update slider on window resize
window.addEventListener('resize', updateSlider);
// Initialize the slider
updateSlider();
// Captcha verification
document.getElementById('captchaButton').addEventListener('click', function () {
document.getElementById('captchaIcon').className = 'fa-solid fa-circle-notch loading';
document.getElementById('captchaText').textContent = 'Verification in progress...';
document.getElementById('captchaButton').style.display = 'none';
setTimeout(function () {
document.getElementById('captchaIcon').className = 'fa-solid fa-shield-heart';
document.getElementById('captchaText').textContent = 'Verification successful!';
}, 2000);
});
// Chat popup
const openPopupButton = document.getElementById('openPopup');
const popupForm = document.getElementById('popupForm');
const closePopupButton = document.getElementById('closePopup');
const form = document.getElementById('contactForm');
const popupContent = document.querySelector('.popup-content');
openPopupButton.addEventListener('click', () => {
popupForm.style.display = 'block';
});
closePopupButton.addEventListener('click', () => {
popupForm.style.display = 'none';
});
// // Handle form submission
popupContent.addEventListener('submit', (e) => {
e.preventDefault();
popupForm.innerHTML = `
<div class="submitted-message">
<h2>Thank you!</h2>
<p>Our unicorns are now working their magic and will get back to you soon.</p>
</div>
`;
popupForm.style.backgroundColor = '#ffc107';
popupContent.style.color = 'white';
window.addEventListener('click', function (event) {
if (!event.target.matches('.popupForm')) {
popupForm.style.display = 'none';
}
});
});
// Event listener for language selector
const selectedLanguageButton = document.getElementById('selected-language');
const currentFlagImage = document.getElementById('current-flag');
const languageOptions = document.getElementById('language-options');
languageOptions.addEventListener('click', function(event) {
if (event.target.closest('button')) {
const selectedButton = event.target.closest('button');
const newFlag = selectedButton.getAttribute('data-flag');
currentFlagImage.src = newFlag;
}
});
// Event listener for burger menu
const menuBars = document.querySelector('#menu3 .fa-bars');
const menuDropdown = document.getElementById('menu3-dropdown');
menuBars.addEventListener('mouseover', function () {
menuDropdown.style.display = 'flex';
});
menuDropdown.addEventListener('mouseleave', function () {
menuDropdown.style.display = 'none';
});
// Prevent subscribe button and footer links to work
const subscribeBtn = document.querySelectorAll('.subscribe-button');
const footerLinks = document.querySelectorAll('.footer a');
const socialIcons = document.querySelectorAll('.social-icons a');
// // Prevent default action for newsletter submit button
subscribeBtn.forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
});
});
// // Prevent default action for footer links
footerLinks.forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
});
});
// // Prevent default action for social icons
socialIcons.forEach(icon => {
icon.addEventListener('click', (e) => {
e.preventDefault();
});
});