-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (22 loc) · 852 Bytes
/
script.js
File metadata and controls
26 lines (22 loc) · 852 Bytes
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
document.querySelectorAll(".smooth-scroll").forEach((anchor) => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
document.querySelector(this.getAttribute("href")).scrollIntoView({
behavior: "smooth",
});
});
});
// Aguarde o carregamento do DOM
document.addEventListener("DOMContentLoaded", function () {
// Selecione todos os links no nav
const navLinks = document.querySelectorAll('#main-nav a');
// Adicione um ouvinte de evento de clique a cada link
navLinks.forEach(function (link) {
link.addEventListener('click', function () {
// Encontre o checkbox de toggle-mobile
const toggleMobile = document.getElementById('toggle-mobile');
// Desmarque o checkbox para fechar a navegação móvel
toggleMobile.checked = false;
});
});
});