-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
47 lines (28 loc) · 915 Bytes
/
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
46
47
const nav = document.querySelector('#header nav')
const toggle = document.querySelectorAll('nav .toggle')
for (const element of toggle) {
element.addEventListener('click', function () {
nav.classList.toggle('show')
})
}
/* quando clicar em um item do menu, esconder o menu */
const links = document.querySelectorAll('nav ul li a')
for (const link of links) {
link.addEventListener('click', function () {
nav.classList.remove('show')
})
}
const backToTopButton = document.querySelector('.back-to-top')
function backToTop() {
if (window.scrollY >= 200) {
backToTopButton.classList.add('show')
} else {
backToTopButton.classList.remove('show')
}
}
function menssagem() {
return alert("Menssagem enviada com sucesso");
}
window.addEventListener('scroll', function () {
backToTop();
})