website/static/js/square_box.js

18 lines
509 B
JavaScript
Raw Permalink Normal View History

2023-06-05 18:27:32 +02:00
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);
}
};