A pure JS lightbox gallery plugin for Bootstrap 5 based on the modal and carousel plugins
npm install @w8tcha/bs5-lightboxshell
npm i @w8tcha/bs5-lightbox
`
Lightbox for Bootstrap 5 will automatically initialize on import:
`js
import '@w8tcha/bs5-lightbox'
`
By default it will target elements with the data-toggle="lightbox" attribute.
If you want to target a different element, import the Lightbox class and instantiate it:
`js
import Lightbox from '@w8tcha/bs5-lightbox'
for (const el of document.querySelectorAll('.my-lightbox-toggle')) {
el.addEventListener('click', Lightbox.initialize)
}
`
Contributing
Lightbox for Bootstrap 5 is written in pure JavaScript.
Modify the src/index.js file, run npm run build` and create a pull request.