Assessment! for Image Gallery

Hi there,

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!

Link to assessment:

Link to code:

Hi @Kebin

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() {
  ...
}

Have a nice weekend,
Michael

Hi @mikoMK,

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.

Have a great day,
Kevin

1 Like

I’m glad it’s working now.
Looks perfect now :+1:

1 Like