parent
236f68461b
commit
fe235cf473
@ -1,17 +1,22 @@
|
|||||||
const container = document.querySelector('.container')
|
const container = document.querySelector('.container');
|
||||||
const unsplashURL = 'https://source.unsplash.com/random/'
|
const unsplashURL = 'https://source.unsplash.com/random/';
|
||||||
const rows = 5
|
const picsumURL = 'https://picsum.photos';
|
||||||
|
const rows = 5;
|
||||||
|
|
||||||
for(let i = 0; i < rows * 3; i++) {
|
for (let i = 0; i < rows * 3; i++) {
|
||||||
const img = document.createElement('img')
|
const img = document.createElement('img');
|
||||||
img.src = `${unsplashURL}${getRandomSize()}`
|
/* Unplash's server is down at the moment. Use 'picsum' instead
|
||||||
container.appendChild(img)
|
img.src = `${unsplashURL}${getRandomSize()}`;
|
||||||
|
*/
|
||||||
|
// Picsum URL: https://picsum.photos/<width>/<height>/?<randomChar>
|
||||||
|
img.src = `${picsumURL}/${getRandomNr()}/${getRandomNr()}/?${i}`;
|
||||||
|
container.appendChild(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomSize() {
|
function getRandomSize() {
|
||||||
return `${getRandomNr()}x${getRandomNr()}`
|
return `${getRandomNr()}x${getRandomNr()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomNr() {
|
function getRandomNr() {
|
||||||
return Math.floor(Math.random() * 10) + 300
|
return Math.floor(Math.random() * 10) + 300;
|
||||||
}
|
}
|
Loading…
Reference in new issue