-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
137 lines (124 loc) · 4.35 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Coming Soon!</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="modal-container">
<div class="modal">
<div class="modal-title">Great!</div>
You've successfully subscribed!
<button onClick="closeModal()" class="modal-button">Ok</button>
</div>
</div>
<div class="container">
<div class="header">
<h1>Coming Soon</h1>
<p>Travel with us and have fun!</p>
</div>
<div class="countdown">
<h2>Countdown to Launch</h2>
<div id="timer">
<div>
<span id="days"></span>
<div class="smalltext">Days</div>
</div>
<div>
<span id="hours"></span>
<div class="smalltext">Hours</div>
</div>
<div>
<span id="minutes"></span>
<div class="smalltext">Minutes</div>
</div>
<div>
<span id="seconds"></span>
<div class="smalltext">Seconds</div>
</div>
</div>
</div>
<div class="subscribe">
<h2>Subscribe to Newsletter</h2>
<form id="form">
<input
type="email"
name="email"
id="email"
placeholder="Enter your email"
pattern=".*@.+\..+"
oninvalid="this.setCustomValidity('Please type a valid email adress.')"
oninput="this.setCustomValidity('')"
required
/>
<button type="submit" id="submit-button">Subscribe</button>
</form>
</div>
<div class="social-icons">
<!-- Add your social media icons and links here -->
<!-- <a href="#" target="_blank"><img src="facebook-icon.png" alt="Facebook"></a>
<a href="#" target="_blank"><img src="twitter-icon.png" alt="Twitter"></a>
<a href="#" target="_blank"><img src="instagram-icon.png" alt="Instagram"></a> -->
</div>
</div>
<script>
//modal to show after submit
const modal = document.getElementsByClassName("modal-container")[0];
//function to close the modal
const closeModal = () => {
modal.style.display = "none";
};
// Set the launch date (May 25th, 2024)
const launchDate = new Date("July 20, 2024 00:00:00").getTime();
modal.style.display = "none";
// Update the countdown every second
const x = setInterval(function () {
const now = new Date().getTime();
const distance = launchDate - now;
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor(
(distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Update the countdown elements
document.getElementById("days").innerHTML = days;
document.getElementById("hours").innerHTML = hours;
document.getElementById("minutes").innerHTML = minutes;
document.getElementById("seconds").innerHTML = seconds;
// If the countdown is over, display a message
if (distance < 0) {
clearInterval(x);
document.getElementById("timer").innerHTML = "EXPIRED";
}
}, 1000);
//email input box
const email_input = document.getElementById("email");
//submit button
const form = document.getElementById("form");
//event listener for submit button (send email)
const submit = (e) => {
e.preventDefault();
fetch("https://api.emailjs.com/api/v1.0/email/send", {
method: "post",
headers: new Headers({
"Content-Type": "application/json",
}),
body: JSON.stringify({
service_id: "service_16ue3l1",
template_id: "template_grkxpzn",
user_id: "77UgS9qa0ahuZ4hqO",
template_params: {
email: email_input.value,
},
}),
})
.then((res) => (modal.style.display = "flex"))
.catch((err) => console.log(err));
};
form.addEventListener("submit", submit);
</script>
</body>
</html>