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