mirror of
https://git.librezo.fr/Librezo/website.git
synced 2024-12-05 01:05:16 +01:00
18 lines
509 B
JavaScript
18 lines
509 B
JavaScript
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);
|
|
}
|
|
};
|