-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
64 lines (47 loc) · 1.64 KB
/
app.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
63
64
// button dark theme
const $html = document.querySelector('html');
const $checkbox = document.querySelector('#switch');
$checkbox.addEventListener('change', function () {
$html.classList.toggle('dark-mode')
})
//botao scroll
const btn = document.getElementById("Btn");
btn.addEventListener('click', () => window.scrollTo({
top: 0,
behavior: 'smooth',
}));
// Validação do formulário
/*
function validarFormulario() {
var nome = document.getElementById('nome').value;
var email = document.getElementById('email').value;
var telefone = document.getElementById('telefone').value;
var assunto = document.getElementById('assunto').value;
var messagem = document.getElementById('mensagem').value;
if (nome.trim() === '' || email.trim() === '' || telefone.trim() === '' || assunto.trim() === '' || messagem.trim() === '') {
alert('Por favor, preencha todos os campos.');
return false;
}
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email)) {
alert('Por favor, insira um endereço de e-mail válido.');
return false;
}
alert('A mensagem foi enviada com sucesso!😀');
document.getElementById('form').reset();
return true;
}
*/
//botao-menu
let btnMenu = document.getElementById('btn-menu');
let menu = document.getElementById('menu-mobile');
let overlay = document.getElementById('overlay-menu');
btnMenu.addEventListener('click', () => {
menu.classList.add('abrir-menu')
})
menu.addEventListener('click', () => {
menu.classList.remove('abrir-menu')
})
overlay.addEventListener('click', () => {
menu.classList.remove('abrir-menu')
})