23 lines
No EOL
858 B
JavaScript
23 lines
No EOL
858 B
JavaScript
let texte = document.getElementById("text");
|
|
let p_counter = 0;
|
|
let texts = document.getElementsByClassName("textWillAppear");
|
|
let questions = document.getElementsByClassName('questionWillAppear');
|
|
console.log(questions);
|
|
|
|
function makeNextTextAppear(event) {
|
|
if (event.keyCode == 13 || event.keyCode == 32) {
|
|
if(p_counter < 2) {
|
|
texts[p_counter].style.cssText = "animation: fade 2s forwards;";
|
|
}
|
|
if (p_counter >= 2 && p_counter < 6) {
|
|
questions[p_counter-2].style.cssText = "animation: fade 2s forwards;";
|
|
console.log(questions[p_counter-2].style.cssText);
|
|
}
|
|
if(p_counter >= 6 && p_counter < 8) {
|
|
texts[p_counter-4].style.cssText = "animation: fade 2s forwards;";
|
|
}
|
|
p_counter += 1;
|
|
}
|
|
}
|
|
|
|
document.addEventListener("keypress", makeNextTextAppear); |