title
A prototype
*{box-sizing: border-box;} body{ margin:0; display:flex; flex-wrap:wrap; overflow:hidden; } .box{ width:50vw; height:50vh; background:purple; border:1px solid red; } .box img{ object-fit:cover; width:100%; height:100%; }
d = document b = d.body let boxes = d.querySelectorAll(".box") boxes.forEach(box => { box.onclick = function(){ let rand = Math.round(Math.random() * 39) let image = this.querySelector('img') image.setAttribute('src',"folder/"+rand+".jpg") } });
snap
save
new
fork
download
html
css
js
output
gallery
config
➚ link to output
➚ snap player
font size
live reload
snap mode
layout
⤷ switch
★ info and code