Start lightbox from outside gallery
For anyone else who is interested:
I embed my galleries in Wordpress pages/posts. Since there's nothing on the gallery itself to indicate that it has a lightbox, I wanted to add a "link" below the gallery to start the lightbox manually. Support provided the following instructions, which I thought I would share in case anyone else finds them useful:
<div onclick="bwg_gallery_box( 8, jQuery( '.bwg_container' ))">Start Lightbox</div>
Replace the "8" with the ID for the image you want to start the lightbox with. Note that this is not the number in the "#" column in the gallery control panel. Rather, it is the number in the "data-image-id" or "image_id" tags in the HTML for the gallery.
You can use the same technique to trigger the lightbox automatically when a user visits the page/post by adding the following script between the <head>...</head> tags:
<script>
window.addEventListener("load", function(){
bwg_gallery_box( 8, jQuery( '.bwg_container' ));
}, false);
</script>
-
Official comment
Dear Andrew,
Happy to see you shared this solution with the community.Sincerely,
Please sign in to leave a comment.
Comments
1 comment