Image Lightbox Gallery
A thumbnail gallery that opens images in a Bootstrap modal lightbox.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div style="max-width:340px"><div class="row g-2" id="lbGrid">
<div class="col-4"><div class="rounded" data-lb="#ff7a18,#ff477e" style="height:70px;background:linear-gradient(135deg,#ff7a18,#ff477e);cursor:pointer"></div></div>
<div class="col-4"><div class="rounded" data-lb="#5b6cff,#00d4ff" style="height:70px;background:linear-gradient(135deg,#5b6cff,#00d4ff);cursor:pointer"></div></div>
<div class="col-4"><div class="rounded" data-lb="#16a34a,#a3e635" style="height:70px;background:linear-gradient(135deg,#16a34a,#a3e635);cursor:pointer"></div></div>
</div>
<div class="modal fade" id="lbModal" tabindex="-1"><div class="modal-dialog modal-dialog-centered"><div class="modal-content border-0"><div id="lbBig" style="height:240px;border-radius:.5rem"></div></div></div></div></div>var modal=new bootstrap.Modal(document.getElementById('lbModal')),big=document.getElementById('lbBig');
document.querySelectorAll('#lbGrid [data-lb]').forEach(function(d){d.onclick=function(){var c=d.dataset.lb.split(',');big.style.background='linear-gradient(135deg,'+c[0]+','+c[1]+')';modal.show()}});Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.