Multiple Galleria Image Galleries on One Page

So I had a client that wanted multiple galleries on one page. The page is created from a database, so there could be any number of galleries. The issue I had was making more then one gallery work in their own modal. Using and their basic instructions, only the first one I would click on would work, the rest gave me an error.

So I wrote this little javascript to run the gallery when the link to open the modal was clicked and it works like a charm:

$(document).ready(function() {
        $("[id^=gallerylink]").each(function() {
                var gallerydiv = '#' + $(this).attr('id');

                $(gallerydiv).click(function() {
              $(gallerydiv).attr('data-target'), {
                                height: 650
Go back to top