NoroffFEU / musikkforandrerliv.no

https://norofffeu.github.io/musikkforandrerliv.no/
The Unlicense
8 stars 3 forks source link

Gallery JS file #223

Open ukonuidika opened 2 months ago

ukonuidika commented 2 months ago

Add Gallery JS file

ukonuidika commented 2 months ago

Below is the JavaScript code that controls the animation of gallery images.

function enlargeImage(image) { image.classList.add('enlarged'); }

function shrinkImage(image) { image.classList.remove('enlarged'); }

function fadeInImage(image) { image.style.opacity = '0'; let opacity = 0; const fadeInInterval = setInterval(() => { if (opacity < 1) { opacity += 0.05; image.style.opacity = opacity; } else { clearInterval(fadeInInterval); } }, 50); }