boîtes accueil qui bougent

This commit is contained in:
Pascal Engélibert
2023-06-05 18:27:32 +02:00
parent b465f0f19a
commit 12547f2611
4 changed files with 45 additions and 8 deletions

17
static/js/square_box.js Normal file
View File

@ -0,0 +1,17 @@
var square_box_classes = ["square_box-inner-left", "square_box-inner-right", "square_box-inner-top", "square_box-inner-bottom"];
var randomize_square_box = function (elem) {
var r = Math.floor(Math.random()*4);
for(i in square_box_classes) {
if(i != r)
elem.classList.remove(square_box_classes[i]);
}
elem.classList.add(square_box_classes[r]);
}
window.onload = function() {
for(elem of document.getElementsByClassName("square_box-inner")) {
var elem = elem;
randomize_square_box(elem);
}
};