User:Célian/test.js: Difference between revisions
From Test Wiki
Content deleted Content added
Created page with "document.querySelectorAll('*').forEach(element => { element.style.animation = 'dance 1s infinite'; });" |
mNo edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
element.style.animation = 'dance 1s infinite'; |
element.style.animation = 'dance 1s infinite'; |
||
}); |
}); |
||
document.body.style.fontFamily = 'Comic Sans MS'; |
|||
document.addEventListener('DOMContentLoaded', function() { |
|||
var audio = new Audio('https://upload.wikimedia.org/wikipedia/commons/1/10/Soundfont_Comparison_%28Updated%29.wav'); |
|||
audio.play(); |
|||
}); |
|||
document.addEventListener('click', function() { |
|||
var audio = new Audio('https://upload.wikimedia.org/wikipedia/commons/1/10/Soundfont_Comparison_%28Updated%29.wav'); |
|||
audio.play(); |
|||
}); |
|||
for (var i = 0; i < 100; i++) { |
|||
var confetti = document.createElement('div'); |
|||
confetti.style.position = 'absolute'; |
|||
confetti.style.width = '5px'; |
|||
confetti.style.height = '5px'; |
|||
confetti.style.background = 'red'; |
|||
confetti.style.top = Math.random() * window.innerHeight + 'px'; |
|||
confetti.style.left = Math.random() * window.innerWidth + 'px'; |
|||
document.body.appendChild(confetti); |
|||
// Animer les confettis |
|||
setInterval(function() { |
|||
confetti.style.top = parseInt(confetti.style.top) + 1 + 'px'; |
|||
if (parseInt(confetti.style.top) > window.innerHeight) { |
|||
confetti.style.top = '0px'; |
|||
} |
|||
}, 10); |
|||
} |
|||