Hi @danielwerner23 ,
You can use a plugin like https://ww.wp.xz.cn/plugins/gallery-lightbox-slider/
I think it should work with your existing blocks.
Thanks for you anwer. I’ve tried it, but i will only get the switch button under my block but no changes in my frontend.
I see @danielwerner23
When I use this plugin it auto adds lightbox on gallery image click in the frontend.
Not sure about the switch you’re talking about.
Are you using the default WP gallery block or some kind of custom solution?
You can also use a JavaScript library like https://simplelightbox.com/
There is a plugin too https://ww.wp.xz.cn/plugins/simplelightbox/
Make sure that in the gallery settings you’ve selected link to media file (lightbox needs the link to full image to work properly)
If it doesn’t work out of the box you can try firing some JavaScript manually:
var lightbox = new SimpleLightbox('.gallery a', { /* options */ });
https://simplelightbox.com/#usage
You should replace .gallery class with one one you use in your theme like .wp-block-image etc
Do you know how to add JavaScript to your theme? https://themeisle.com/blog/wordpress-custom-javascript/
Glad it worked for you. Let me know if you need any help.
Thanks