-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (25 loc) · 878 Bytes
/
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
const navToggle = document.querySelector(".nav-toggle")
const navLinks = document.querySelectorAll(".nav-link")
navToggle.addEventListener('click', () => {
document.body.classList.toggle('nav-open')
})
navLinks.forEach(link => {
link.addEventListener('click', () => {
document.body.classList.remove('nav-open')
})
})
let parts = ["micha", "ella", "com", ".", "@", "hotmail"];
let email = parts[0] + parts[3] + parts[1] + parts[4] + parts[5] + parts[3] + parts[2];
const emailEl = document.getElementById("email")
emailEl.innerHTML = email
emailText = emailEl.innerHTML;
emailEl.addEventListener("click", copyToClipboard)
async function copyToClipboard() {
try {
await navigator.clipboard.writeText(emailText);
alert("Copied the text: " + emailText);
}
catch (err) {
alert("Failed to copy: " + err)
}
}