-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
64 lines (50 loc) · 1.92 KB
/
index.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
// NAVBAR
const btnBack = document.getElementById("back");
const logoSecond = document.getElementById("logo-second");
const principalLogo = document.getElementById("principal-logo");
// SECCIONES
const welcomeSection = document.getElementById("welcome");
const homeSection = document.getElementById("home");
// IMPRIMIR NOMBRE
const inputName = document.getElementById("input-name");
const btnName = document.getElementById("btn-welcome-name");
const nameSpace = document.getElementById("name-space");
// Cuenta regresiva
const element = document.getElementById("countdown");
// time es igual a los milisegundos en un segundo
let time = 1000;
// SECCIÓN BIENVENIDA
const btnGetName = document.getElementById("btn-welcome-name");
let chronometer;
// Pasar a sección HOME
btnGetName.addEventListener("click", getName);
// SECCIÓN HOME
// Elegir tipo de preguntas
const btnColors = document.getElementById("btn-colors");
const btnAnimals = document.getElementById("btn-animals");
const questionColor = document.getElementById("q-color");
const imgColors = document.getElementById("colors-img");
const exitBtn = document.getElementById("exit");
const questionAnimals = document.getElementById("q-animals");
btnColors.addEventListener("click", goColorsSection);
// Ir a sección de preguntas sobre animales
// const goAnimalsSection = () => {
// homeSection.classList.add("hidde-section");
// questionAnimals.classList.remove("hidde-section");
// btnBack.classList.add("hidde-btn");
// exitBtn.classList.remove("hidde-btn");
// imgAnimals.classList.remove("hidde-figure");
// };
// btnAnimals.addEventListener("click", goAnimalsSection);
// se define la catidad de segundos que va a durar nuestra cuenta regresiva
btnColors.addEventListener("click", e => {
goColorsSection;
if (e) countdown(10);
});
// Ir a HOME con salir (x)
exitBtn.addEventListener("click", e => {
if (e) {
clearInterval(chronometer);
goHomeSection;
}
});