Skip to content

How to open glightbox on loading page? #388

Closed Answered by gingerchew
mxkeke asked this question in Q&A
Discussion options

You must be logged in to vote

You'd have to use an event listener on either the DOMContentLoaded document event or the load window event.

const lightbox = GLightbox();

document.addEventListener('DOMContentLoaded', () => lightbox.open(), { once: true })
// or
window.addEventListener('load', () => lightbox.open(), { once: true });

Replies: 2 comments

Comment options

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

You must be logged in to vote
0 replies
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