You have to unset the background colour when you leave the div again. This can be done within the same listener in jQuery by adding a second handler like
You can’t change the colour of an image like that, but you can use the filter property to do this. If you want to go the background colour route, you have to apply it to the wrapping div like
“unset” is not a valid value. You can do “transparent” or “none”.
Filters aren’t universally supported FYI. Check caniuse.com for filter support and see if it’s a good opition for you.
The only way a background color would work on an image is if there is transparency in it (e.g. PNG or SVG) but that image doesn’t look like it would even have room for that.
You can play with hue-rotate, or brightness to achieve an effect similar to rgba(0,0,0,0.5)… but it’s of course a filter, not simply a plain colour layer over the image. (And yes, it’s experimental.)