Skip to content

Commit

Permalink
Docs upd: added custom contentRemove handler to <picture> example
Browse files Browse the repository at this point in the history
  • Loading branch information
solemone committed Apr 5, 2023
1 parent 2d8a911 commit ac0188b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/custom-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ lightbox.on('contentAppend', (e) => {
}
});

// for next/prev navigation with <picture>
// by default PhotoSwipe removes <img>,
// but we want to remove <picture>
lightbox.on('contentRemove', (e) => {
const { content } = e;
if (content.pictureElement && content.pictureElement.parentNode) {
e.preventDefault();
content.pictureElement.remove();
}
});

lightbox.init();
```

Expand Down

0 comments on commit ac0188b

Please sign in to comment.