I need to add an expand icon on top of a number of existing images. The image is displayed as a thumbnail and expands when clicked. The expand icon is to indicate that the images are clickable. I have the following implementation, but it's not ideal. It would be great if I didn't have to add the <img src="expand-icon.png" class="img-expand" />
on each and every image. I tried adding the icon using the ::after
property, but the icon was not clickable and the position ended below the image not on top.
HTML
<div class="thumbnail-container">
<img src="my-image-that-will-expand-when-clicked.png" class="thumbnail" />
<img src="expand-icon.png" class="img-expand" />
</div>
CSS
.thumbnail {
thumbnail-max-height: auto;
thumbnail-max-width: 500px;
thumbnail: popup;
padding: 10px;
position: relative;
top: 0;
left: 0;
}
.thumbnail-container {
display: table-cell;
border: 1px solid #858383;
border-radius: 9px;
position: relative;
}
.img-expand {
position: absolute;
bottom: 5px;
right: 5px;
max-width: 20px;
pointer-events: none
}
And, there is a JS script that runs in the background. I don't have access to that script, the tool runs it in the background.