#776·lightbox2

Missing files/links - add code please

Author: BelowZeroLHCreated Jun 17, 2026Updated Jun 17, 2026

Could you please add code like this? When a user malforms the attributes on images with no source or links the JS crashes. Adding two simple lines will help:

@ line 273 in lightbox.js 2.12.0 add the first line shown here (or something like it): if(!this.album[imageNumber].link) { console.log("LIGHTBOX: IMAGE HREF MISSING!"); return; } // Position Lightbox this.$lightbox.css({ top: this.options.positionFromTop + 'px', left: '0px' }).fadeIn(this.options.fadeDuration);

Then at what will now be line 298 (297 originally) add something like the middle line shown here: var filename = this.album[imageNumber].link; if(!filename) { console.log("LIGHTBOX: IMAGE HREF MISSING!"); return; } var filetype = filename.split('?')[0].split('#')[0].split('.').slice(-1)[0];

Thanks for your consideration. It would save me from having to modify the code every time you release a new version.