mirror of
https://github.com/groupe1cir1n/groupe1CIR1Njs.git
synced 2026-03-18 21:40:30 +01:00
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
function displayWord() {
|
|
const words = document.getElementById('LabHidden').textContent.trim().split(' ');
|
|
words.forEach((word, index) => {
|
|
const wordElement = document.createElement('span');
|
|
wordElement.classList.add('word');
|
|
wordElement.innerText = word;
|
|
wordElement.style.transitionDelay = `${index * 100}ms`;
|
|
//Si le module d'index par 15 atteint 0, on ajoute un <br>
|
|
if (index % 15 === 0) {
|
|
const brElement = document.createElement('br');
|
|
document.getElementById('who_we_are').appendChild(brElement);
|
|
}
|
|
document.getElementById('who_we_are').appendChild(wordElement);
|
|
|
|
// Ajouter un espace après chaque mot, sauf pour le dernier mot
|
|
if (index < words.length - 1) {
|
|
const spaceElement = document.createElement('span');
|
|
spaceElement.innerHTML = ' ';
|
|
document.getElementById('who_we_are').appendChild(spaceElement);
|
|
}
|
|
|
|
setTimeout(() => {
|
|
wordElement.classList.add('show');
|
|
}, 1000);
|
|
});
|
|
}
|
|
|
|
function slide(element, distance, duration, delay) {
|
|
element.style.transform = `translateX(-${distance}px)`; // Déplacer l'élément vers la gauche
|
|
element.style.transition = `transform ${duration}ms ease ${delay}ms`; // Ajouter une transition
|
|
|
|
setTimeout(() => { // Remettre l'élément à sa position initiale
|
|
element.style.transform = 'translateX(0)'; // Déplacer l'élément vers la gauche
|
|
}, 0);
|
|
}
|
|
const element = document.getElementById('LabHidden'); // Récupérer l'élément à animer
|
|
slide(element, 100, 500, 200);
|
|
displayWord();
|
|
|
|
|