henrygd / bigger-picture

JavaScript lightbox gallery for images, video, audio, iframes, html. Zoomable, responsive, accessible, lightweight.
https://biggerpicture.henrygd.me
MIT License
231 stars 17 forks source link

Error handling #22

Closed molnarm closed 1 year ago

molnarm commented 1 year ago

Added a callback for error handling, e.g. to display a message instead of the failed item (that's what I'm using it for in our app).

Will get called for error events on:

The callback gets container and activeItem like all the others already present, plus the error itself.

I'm using Windows so I didn't commit the build outputs because they are different from yours (backslashes etc.). Let me know if I should change something else.

henrygd commented 1 year ago

Thanks, I'll review it in the next few days

Edit: Looks good, I'll get a new version out this weekend.

henrygd commented 1 year ago

Added in 1.1.7.

I did remove the iframe listener because it's not as simple to implement as the others. If users need to add their own logic for iframes, it can be done with onOpen or onUpdate.