miromannino / Justified-Gallery

Javascript library to help creating high quality justified galleries of images. Used by thousands of websites as well as the photography community 500px.
http://miromannino.github.io/Justified-Gallery/
MIT License
1.69k stars 299 forks source link

fixes #389 #390

Open saas786 opened 4 months ago

saas786 commented 4 months ago

Upon troubleshooting, it was found that when an image throws an error, this inside the callback refers to the image element and not the JustifiedGallery instance. This causes a TypeError because this.resetImgSrc is not a function in the context of the image element.

To resolve this, I ensured that this correctly refers to the JustifiedGallery instance by using .bind(this) on the callback function.

Also might help resolve: https://github.com/miromannino/Justified-Gallery/issues/333, https://github.com/miromannino/Justified-Gallery/issues/351