Skip to content

before_close event #499

Answered by gingerchew
Offerel asked this question in Q&A
Jul 2, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

No but you could add an event listener in the open event to the close button, then you can do any cleanup work you need to do in that handler.

lightbox.on('open', () => {
	document.querySelector({{ the glightbox close button selector }})
		.addEventListener('click', () => {
			// do cleanup stuff
		}, { once: true })
})

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Offerel
Comment options

You must be logged in to vote
1 reply
@gingerchew
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #498 on July 02, 2024 11:46.