Assessment needed for Image gallery"

Hello please help, i’m stuck. when i click the button to Darken the image, i can’t lighten up the image except i reload the tab. please check the link to my code below.
https://jsfiddle.net/x3zt014s/

Hello @lawman4sure

sorry for late replay

you issue on that section

function changeOverlay(){
    if(btn.getAttribute('class') == 'dark'){
        
            btn.addEventListener('click', function(e){
                
            btn.setAttribute('class', 'light');
            btn.textContent = 'Lighten';
            overlay.style.backgroundColor = 'rgba(0,0,0,0.5)';
            // overlay.style.backgroundColor = '';
       
       
        });
    }
}

changeOverlay();

you code say to call function changeoverlay
which add event listener to the button in case it has class dark
and the event fire the statement you choose but you never right a code to apply when the button class is light

first you do not need method/function to add listener

just right the event listener and also right the 2 cases when it light or dark

check this one

btn.addEventListener('click', function(e){
            if(btn.getAttribute('class') == 'dark'){
            btn.setAttribute('class', 'light');
            btn.textContent = 'Lighten';
            overlay.style.backgroundColor = 'rgba(0,0,0,0.5)';
            }else{
            btn.setAttribute('class', 'dark');
            btn.textContent = 'Darken';
            overlay.style.backgroundColor = 'rgba(0,0,0,0)';
            }

hope that help and have a nice day :slight_smile: