Inconsistent Image URL Capture in Lightbox
-
Support Request: Inconsistent Image URL Capture in Lightbox
Plugin Details
- Plugin Name: 10Web Photo Gallery free version 1.8.30
- WordPress Version: 6.6.2
- Browser and Version: Chrome 129.0.6668.101
Issue Description
I’m experiencing an issue with capturing the URL of the current image in the Lightbox gallery. The problem occurs when users click through the thumbnails to view images in the Lightbox. The script I’m using only captures the URL for every other image, effectively missing half of the images in the gallery.
Current Code
I’m using the following JavaScript function (WPCode snippet) to attempt to capture the image URL:
function updateImageUrl() { const imageElement = document.querySelector('.bwg_popup_image.bwg_popup_watermark'); if (imageElement && imageElement.src !== previousImageUrl) { previousImageUrl = imageElement.src; console.log('Lightbox - New image selected: ' + previousImageUrl); localStorage.setItem('backgroundImage', previousImageUrl); } }
Expected Behavior
The function should capture and log the URL of each image as it’s displayed in the Lightbox, storing each new URL in localStorage.
Actual Behavior
The function only captures and logs the URL for every other image. When clicking through the thumbnails, it misses the URL for every second image displayed in the Lightbox.
The function does not capture and record the URL of each image when you click on the thumbnails to change images in the Lightbox, but the first one does, the second one does not, and so on.
Questions
- Is there a known issue with image URL capture in the Lightbox for the free version of 10Web Photo Gallery?
- Are there any specific events or hooks provided by the plugin that I should be using to reliably capture image changes in the Lightbox?
- Is there a recommended method or best practice for capturing the current image URL in the Lightbox that I’m not aware of?
Additional Information
- I’ve verified that the
.bwg_popup_image.bwg_popup_watermark
selector is correct for targeting the image element. - The issue persists across different galleries and image sets.
- I’ve tried various timing approaches (e.g., setTimeout) without success.
Any assistance or guidance on how to consistently capture the URL for each image displayed in the Lightbox would be greatly appreciated. Thank you for your time and support.
- You must be logged in to reply to this topic.