0

I have the following setup using jquery 1.11.3 and the new release 1.2 of lightgallery (https://github.com/sachinchoolur/lightGallery) installed by bower. I tried several variants with and without the selector e.g. the following, but always the gallery opens (ok), but shows below JS error and a spinning symbol. What is wrong with that?

// include the js and css ...
<script>
    (function ($) {
        $(document).ready(function () {
            $('.multiSRC ul').lightGallery({
                selector: "li"
            }); 
        });
    })(jQuery);
</script>

and

<div class="ce_rsce_cl_gallery first block">
    <h2>Vestibulum mollis.</h2>
    <div class="field singleSRC">
        <div class="inner">
            <figure class="image_container">
                <img src="assets/images/d/unsplash_528e297be299b_1_thumb-224ccacd.jpg" alt="" class="" height="250" width="250">
            </figure>
        </div>
    </div>

    <div class="field multiSRC">
        <div class="inner">
            <ul>
                <li>
                    <figure class="image_container">
                        <a href="files/upload/photo-1426174840074-541ae41efdb9.jpg" data-lightbox="lb208875">
                            <img src="assets/images/2/photo-1426174840074-541ae41efdb9-71ccd312.jpg" alt="" class="" height="125" width="125">
                        </a>
                    </figure>
                </li>
                <li>
                    <figure class="image_container">
                        <a href="files/upload/photo-1425934398893-310a009a77f9.jpg" data-lightbox="lb208875">
                            <img src="assets/images/4/photo-1425934398893-310a009a77f9-ba3b2cd4.jpg" alt="" class="" height="125" width="125">
                        </a>
                    </figure>
                </li>
            </ul>
        </div>
    </div>
</div>

This error occurs:

21:04:43.287 TypeError: src is undefined1 lightgallery.js:393:12

which is

var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9self\-]+)/i);

Do I do something wrong? Or is some bug hiding in the lightgallery script?

Geo Jacob
  • 5,909
  • 1
  • 36
  • 43
CeeL
  • 25
  • 5

1 Answers1

1

Selector object should have data-src/href attribute with large version url of your image/video.. So you can just change selector value to li a

$('.multiSRC ul').lightGallery({
    selector: "li a"
});

Here is the working demo. http://jsfiddle.net/amL2Lpqa/1/

Clr
  • 687
  • 7
  • 11