Could anyone kindly check my code for the Image gallery assessment please?
I’m stuck on the darken and lighten button part. I can manage to make it lighten, then darken the picture, but I can’t continuously do it like the MDN example. Could anyone please help? Thank you!
The reason is that you are setting the classes “Darken” and “Lighten”, but you check for class “dark”. So you should set “dark” and “light” instead.
Another small thing:
Inside the click handler you used function darken() {...}. You should either use an anonymous function function () {...} or define the function outside and just set the name:
btn.addEventListener('click', darken);
function darken() {
...
}
Oh wow, it was such a small mistake I overlooked. Thank you so much for pointing it out! as well as the little thing about the function.
Have fixed my code and now it’s working.