An assessment is required for the "image gallery"

Hi everybody.

Please rate my work.

A link to the example that is made in the “Glitch”.

A link to the assessment page.

Thank you all very much.

Great work, @petrushya!

Excellently solved.
To make things simpler, instead of getAttribute() and setAttribute() you could use dot notation.
For example:

overlay.setAttribute('style','background-color: rgba(0,0,0,0.3)');

becomes

overlay.style.backgroundColor = 'rgba(0,0,0,0.3)';

I hope that helps. :slightly_smiling_face:
Michael

Hi @mikoMK.

Thanks for the hint, I haven’t read about replacing the dash with camel notation yet. I wanted to write a “overlay.style.background=‘rgba(…)’;”, but the “background-color” is specified in the task.
But why doesn’t it work for “for” when creating the “label” element?

Have a nice weekend.
Pyotr

1 Like

That’s a great question!
There are two attributes that have a different name in JS: for :arrow_right: htmlFor and class :arrow_right: className. The reason is that for and class are reserved words in JavaScript.

As we already saw, when using style we need to change the CSS properties from kebab-case to camelCase. That’s because dashes are not allowed in identifiers (names of variables/methods/properties).

1 Like

Thank you so much for the explanations! :slightly_smiling_face:

Good bye.

1 Like