diff --git a/docs/custom-content.md b/docs/custom-content.md index 14bf75788..bf83673de 100644 --- a/docs/custom-content.md +++ b/docs/custom-content.md @@ -87,6 +87,17 @@ lightbox.on('contentAppend', (e) => { } }); +// for next/prev navigation with +// by default PhotoSwipe removes , +// but we want to remove +lightbox.on('contentRemove', (e) => { + const { content } = e; + if (content.pictureElement && content.pictureElement.parentNode) { + e.preventDefault(); + content.pictureElement.remove(); + } +}); + lightbox.init(); ```