From c855b1b417390e7d44b5945c8a09eaff622db8dd Mon Sep 17 00:00:00 2001 From: Eric Newton Date: Fri, 8 Apr 2022 17:47:17 -0400 Subject: [PATCH] fix undefined resetImgSrc inside error handler due to jquery rewriting what `this` is --- src/js/justifiedGallery.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/justifiedGallery.js b/src/js/justifiedGallery.js index 75d5fe0a..fca1bbaf 100755 --- a/src/js/justifiedGallery.js +++ b/src/js/justifiedGallery.js @@ -192,8 +192,9 @@ JustifiedGallery.prototype.displayEntry = function ($entry, x, y, imgWidth, imgH if (imageSrc) { imageSrc = this.newSrc(imageSrc, imgWidth, imgHeight, $image[0]); + var self = this; $image.one('error', function () { - this.resetImgSrc($image); //revert to the original thumbnail + self.resetImgSrc($image); //revert to the original thumbnail }); var loadNewImage = function () {