lightbox2 icon indicating copy to clipboard operation
lightbox2 copied to clipboard

Keyboard navigation with arrows malfunctioning when Lightbox initialized multiple times

Open MichalRemis opened this issue 4 years ago • 0 comments

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:

  1. go to https://lokeshdhakar.com/projects/lightbox2/ ,
  2. open console and type lightbox.init()
  3. click on FOUR IMAGE SET lightbox and try to navigate with arrows

MichalRemis avatar Jan 16 '21 11:01 MichalRemis