ngx-lightbox
ngx-lightbox copied to clipboard
Multiple lightboxes open if clickable image is under the first lightbox
Hard to explain what exactly is happening but, I have a bunch of images on a page (like a gallery), all set up to use lightbox. If you click on one, it opens the lightbox. If you click outside of the lightbox (to close it) and your mouse is over one of the other images, it'll not close the lightbox but instead open another one directly overtop. This is inconsistent though and doesn't always occur.
Lightbox can only be opened when u invoked it. E.g
this._lightbox.open(...)
You can look for more example here https://github.com/themyth92/ngx-lightbox#component
I think what you can do is to prevent open lightbox if one is already opened ? Like a flag or something. That way it can only close the lightbox when it is outside the opened modal and not open a new lightbox. E.g:
open(index: number): void {
// open lightbox
if (!this.lightboxOpened) {
this._lightbox.open(this._albums, index);
}
}