electerious / electerious/basicLightbox
<picture> tag support
- Dominant language
- JavaScript
- Stars
- 604
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to add support for webp image formats with jpg fallbacks. When I write my listener like this the lightbox works as intended:
```
window.addEventListener('load', (event) => {
document.querySelectorAll('.modal').forEach(image => {
image.addEventListener('click', e => {
basicLightbox.create(`
`).show();
});
});
});
```
However, when I write my listener like this, the lightbox does not close when I click on the image, only when I click on the background, making the lightbox difficult to close:
```
window.addEventListener('load', (event) => {
document.querySelectorAll('.modal').forEach(image => {
image.addEventListener('click', e => {
basicLightbox.create(`
`).show();
});
});
});
```
I imagine this has something to do with the `` tag. Any thoughts on why this would be happening? Thanks
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the two listener variants from the issue, comparing the plain img markup with the picture/source/img markup. Start at basicLightbox.create(...).show() and trace how clicks on the displayed content and background are handled. Done means the picture-based WebP fallback lightbox closes when the image is clicked, as the plain img version does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100