trvswgnr / bs5-lightbox

A pure JS lightbox gallery plugin for Bootstrap 5 based on the Modal and Carousel components
https://trvswgnr.github.io/bs5-lightbox/
MIT License
129 stars 28 forks source link

console error - png bug #4

Closed pfpro closed 2 years ago

pfpro commented 2 years ago

Hi there,

are there any restrictions to PNG format?

i get error message in console:

=== CHROME (index):1 Uncaught TypeError: Cannot read properties of undefined (reading 'previousSibling') at HTMLImageElement.onload ((index):1)

=== FIREFOX Uncaught TypeError: this.add is undefined

when i use JPG file everything works fine ...

trvswgnr commented 2 years ago

There shouldn't be any issues with PNG images. I'll take a look and try to recreate this.

pfpro commented 2 years ago

thank you.

although I now believe that it has nothing to do with the file type. the error described occurs when i use the "gallery feature".

Rafael-Esteves commented 2 years ago

This error seems to be caused by line 97: onload += /\.png/.test(src) ?this.add.previousSibling.remove(): '';

I just commented it out and the error is gone. No idea what this line was doing tho

I suppose it's removing the previous element in case the current one is a png image because otherwise it could cause issues of overlapping backgrounds.

trvswgnr commented 2 years ago

This has been resolved in v1.7.10