wp-duckbehaviorjournal/assets/js/lightbox.js
Kumi 4de71503e8
fix(lightbox): improve compatibility and responsiveness
Updated lightbox initialization to use jQuery namespace for better compatibility. Tweaked CSS to use viewport units for enhanced responsiveness. These changes aim to prevent potential conflicts and adapt lightbox content better to different screen sizes.
2024-08-06 20:26:13 +02:00

19 lines
No EOL
518 B
JavaScript

jQuery(document).ready(function() {
const $ = jQuery;
$('div.wp-caption a:first-child').click(function(event) {
event.preventDefault();
var imgSrc = $(this).attr('href');
$('#lightbox-img').attr('src', imgSrc);
$('#lightbox').fadeIn();
});
$('.lightbox-close').click(function() {
$('#lightbox').fadeOut();
});
$(document).click(function(event) {
if ($(event.target).is('#lightbox')) {
$('#lightbox').fadeOut();
}
});
});