lightbox2
lightbox2 copied to clipboard
Keyboard navigation with arrows malfunctioning when Lightbox initialized multiple times
When lightbox is initialized multiple times (e.g. when Ajax content is loaded and lightbox needs to be reenabled), Lightbox keyboard navigation doesn't work properly - arrow keys are skipping multiple images, not just one. It's because keyboard listeners are bound multiple times when opening lightbox.
Example:
- go to https://lokeshdhakar.com/projects/lightbox2/ ,
- open console and type
lightbox.init()
- click on FOUR IMAGE SET lightbox and try to navigate with arrows