From 4de71503e8ece1f1ef22a261b141128038411f8c Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 6 Aug 2024 20:26:13 +0200 Subject: [PATCH] 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. --- assets/js/lightbox.js | 5 +++-- style.css | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/js/lightbox.js b/assets/js/lightbox.js index fd27ff3..af7e428 100644 --- a/assets/js/lightbox.js +++ b/assets/js/lightbox.js @@ -1,5 +1,6 @@ -$(document).ready(function() { - $('div.wp-caption a:first').click(function(event) { +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); diff --git a/style.css b/style.css index 0bb9d12..762dc3e 100644 --- a/style.css +++ b/style.css @@ -181,8 +181,8 @@ a h5 { .lightbox-content { margin: auto; display: block; - width: 80%; - max-width: 700px; + max-width: 80vw; + max-height: 90vh; } .lightbox-close {