Nice idea.
Inside the lightbox add title header (or text)
Scope Add a class for the list
–images
in this example
(Otherwise the code will affect other elements)
Before body
Copy paste this code
<script>
$(function() {
$('.images img').each(function () {
var caption = ($(this).attr('alt'));
$(this).next().text(caption);
});
});
</script>
Parts of the code:
$('.images img').each(function () {
loop throw all img inside .images classvar caption = ($(this).attr('alt'));
get the alt from each image and store this alt inside var$(this).next().text(caption);
Change next() dom element (Related tothis
image element)text()
(text docs) to “caption” (The var)
Publish the site - Result:
Before:
After: