-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (23 loc) · 754 Bytes
/
Copy pathscript.js
File metadata and controls
29 lines (23 loc) · 754 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
27
28
29
// botón scroll-to-top
const scrollUp = document.querySelector("#scroll-up");
scrollUp.addEventListener("click", () => {
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
});
});
// modo oscuro switcher
const checkbox = document.querySelector("#checkbox");
checkbox.addEventListener("change", () => {
document.body.classList.toggle("dark");
});
// Mensaje inicio modal pop-up al cargar el DOM
const modal = document.querySelector('.modal');
const modalButtonClose = document.querySelector('.modal__close');
document.addEventListener('DOMContentLoaded', ()=>{
modal.classList.add('modal--visible');
modalButtonClose.addEventListener('click', ()=>{
modal.classList.remove('modal--visible');
});
});