This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathindex.js
62 lines (50 loc) · 1.95 KB
/
index.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
// ripple effect on get early access button
function createRipple(event) {
const button = event.currentTarget;
const circle = document.createElement("span");
const diameter = Math.max(button.clientWidth, button.clientHeight);
const radius = diameter / 2;
circle.style.width = circle.style.height = `${diameter}px`;
circle.style.left = `${event.clientX - button.offsetLeft - radius}px`;
circle.style.top = `${event.clientY - button.offsetTop - radius}px`;
circle.classList.add("ripple");
const ripple = button.getElementsByClassName("ripple")[0];
if (ripple) {
ripple.remove();
}
button.appendChild(circle);
}
const buttons = document.getElementsByTagName("button");
for (const button of buttons) {
button.addEventListener("click", createRipple);
}
// displaying the recaptcha when the user clicks on the input field
const emailInput = document.getElementById('emailInput');
const recaptcha = document.getElementById('recaptcha');
emailInput?.addEventListener('click' , ()=>{
recaptcha.classList.toggle('show');
})
// mobile hamburger opening closing
const hamburger = document.querySelector('.hamburger');
const line1 = document.querySelector('.line1');
const line2 = document.querySelector('.line2');
const line3 = document.querySelector('.line3');
const mobilenav = document.querySelector('#mobilenav');
const body = document.body;
body.addEventListener('click', (e) => {
if (e.target === hamburger || e.target === line1 || e.target === line2 || e.target === line3) {
if (hamburger.classList.contains('hamactive')) {
hamburger.classList.remove('hamactive')
mobilenav.style.left = '-100%'
body.style.overflowY = 'auto';
} else {
hamburger.classList.add('hamactive')
body.style.overflowY = 'hidden';
mobilenav.style.left = '0'
}
} else {
hamburger.classList.remove('hamactive')
body.style.overflowY = 'auto';
mobilenav.style.left = '-100%'
}
})