I'm trying to use Lightense on a page where some images are lazy loaded when a toggle is opened. I have a window.addEventListener('load'
set up on the page generally, and am calling Lightense()
on the images when they are loaded in.
Uncaught TypeError: Cannot read property 'removeEventListener' of undefined
at unbindEvents (lightense.js:366)
at removeViewer (lightense.js:299)
at init (lightense.js:337)
at HTMLImageElement.<anonymous> (lightense.js:193)
if (!d.querySelector('.lightense-backdrop')) {
...
} else {
config.container = d.querySelector('.lightense-backdrop');
}
This fix works great, but I wanted to call it out and ask if there was a better solution to this general problem than what I'm doing. Thanks!