HTMLify
Grid
Views: 238 | Author: sticker-archive
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <meta name="viewport" content="width=device-width, initial-scale=1"> <script> fetch("./stickers.json") .then(res => res.json()) .then(data => { // shuffle for (let i = data.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [data[i], data[j]] = [data[j], data[i]]; } // adding data.forEach(name => { const a = document.createElement("a"); a.setAttribute("href", "stickers/" + name); a.setAttribute("target", "_blank"); const img = document.createElement("img"); img.src = "stickers/" + name; img.loading = "lazy"; img.decoding = "async"; img.style.width = "100px"; img.style.height = "100px"; a.appendChild(img) document.body.appendChild(a); }); }); </script> |