-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
42 lines (35 loc) · 1.19 KB
/
script.js
File metadata and controls
42 lines (35 loc) · 1.19 KB
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
const btnMenu = document.querySelector('#btnMenu')
const nav = document.querySelector('.nav-ul')
const copyBtn = document.querySelector('.btn-copy')
const copyText = document.querySelector('#copyEmail')
// Responsive Menu
btnMenu.addEventListener('click', () => {
nav.classList.toggle('show')
})
//Alert
let alertInfo = document.createElement('div')
let closeBtn = document.createElement('button')
closeBtn.classList.add('closeBtn')
closeBtn.innerHTML = '<i class="bi bi-x-circle"></i>'
alertInfo.classList.add('alertInfo')
alertInfo.innerText = "If you see any errors on the website, please let me know!"
const body = document.querySelector('body');
body.prepend(alertInfo)
const x = document.querySelector('.alertInfo')
x.appendChild(closeBtn)
closeBtn.addEventListener('click', () => {
document.body.removeChild(x)
})
function show() {
const di = document.querySelector('.alertInfo')
di.classList.add('show');
}
setTimeout(show, 5000);
// Copy clipboard
copyBtn.addEventListener('click', () => {
copyText.select();
document.execCommand('copy')
copyText.setSelectionRange(0, 99999)
copyBtn.innerHTML = "<i class='bi bi-clipboard-check'></i>"
copyBtn.className = 'coped'
})