to test yourself
It needs to be an <img>
element.
Note passing of parameter to the function here:
Consider using addEventListener
instead of putting onmouseover
in the HTML.
1 Like
JS is one of my weaker subjects, but Iām aware that using in-lines events is not the done thing these days. Kind of the JS equivalent of using in-line styles over CSS.
It may look something like this:-
1 Like
You cant do with videos?
You would use a <video>
element instead of <div>
or <img>
, but the principle is the same.
good
The box needs to have the same aspect ratio as the image, otherwise the image will be stretched (unless you use CSS object-fit
property)
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.