const numItemsToGenerate = 1; //how many gallery items you want on the screen
const numImagesAvailable = 27; //how many total images are in the collection you are pulling from
const imageWidth = 480; //your desired image width in pixels
const imageHeight = 480; //desired image height in pixels
const collectionID = 1678004; //the collection ID from the original url
function renderGalleryItem(randomNumber){
fetch(`https://source.unsplash.com/collection/${1678004}/${480}x${480}/?sig=${randomNumber}`)
.then((response)=> {
let galleryItem = document.createElement('div');
galleryItem.classList.add('gallery-item');
galleryItem.innerHTML = `
`
document.body.appendChild(galleryItem);
})
}
for(let i=0;i
// control the auto refresh rate -> 1000 = 1 second
var refreshRate = 10000; // 10 seconds
// Automatically reload the browser
setInterval(function() {
window.location.reload();
}, refreshRate);
// Hide the images on load
$('.random-image').hide();
// Get a random image from Unsplash and fade it in on load
$('.random-image').css({
// serves a random image from this collection on Unsplash.com
'background-image' : 'url(https://source.unsplash.com/collection/1678004/1600x900)'
}).fadeIn(1500);