forked from akshitagupta15june/Moksh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
45 lines (37 loc) · 1.25 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
let dropMenuLinks = document.querySelector('.dropMenuLinks');
let indexOpenDropDown = document.querySelector('.indexOpenDropDown');
let closeDropDown = document.querySelector('.closeDropDown');
let heroSection = document.querySelector('.heroSection');
indexOpenDropDown.onclick = () => {
dropMenuLinks.style.right = 0;
heroSection.style.zIndex = `1`;
}
closeDropDown.onclick = () => {
dropMenuLinks.style.right = `-2000px`;
heroSection.style.zIndex = `50`;
}
function subscribe() {
var email = document.getElementById('email').value;
// Validate email address
if (!validateEmail(email)) {
showPopup('Please enter a valid email address.');
return;
}
// send the email address to the admin
// For demonstration, let's just show a confirmation message
showPopup('You have successfully subscribed with email: ' + email);
}
function validateEmail(email) {
// Basic email validation
var re = /\S+@\S+\.\S+/;
return re.test(email);
}
function showPopup(message) {
var popup = document.getElementById('popup');
var popuptext = document.getElementById('popuptext');
popuptext.textContent = message;
popup.classList.add('show');
setTimeout(function() {
popup.classList.remove('show');
}, 3000); // Hide popup after 3 seconds
}