Skip to content

How to init Lighbox while using min.bundle.js #14

Answered by trvswgnr
rajeshpv asked this question in Q&A
Discussion options

You must be logged in to vote

If you're using the bundled version in 1.7.11 then the Lightbox class gets added to window.bootstrap so just replace Lightbox with bootstrap.Lightbox. However, this has been changed in v1.8.0 and the Lightbox class is available directly when using the bundled/CDN version.

Also heads up, you can use the Lightbox's initialize method for brevity like so:

document.querySelectorAll('.mytoggle').forEach((el) => el.addEventListener('click', Lightbox.initialize));

Replies: 1 comment

Comment options

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