Reputation: 45
I'm making a video gallery with light gallery plugin in time to run it generates the following error Uncaught TypeError: Can not read property 'match' of undefined, as researched in forums but not yet encotrei a solution.
Test Page:
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9self\-]+)/i);
https://jsfiddle.net/joseferreira/37cgt6jq/
Upvotes: 1
Views: 4030
Reputation: 43
You are using wrong html markup.
Use like this
HTML
<div id="lightgallery">
<a href="images/landding/1.jpg" class="light-link">
<img src="images/landding/1.jpg" />
</a>
<a href="images/landding/1.jpg" class="light-link">
<img src="images/landding/1.jpg" />
</a>
<a href="images/landding/1.jpg" class="light-link">
<img src="images/landding/1.jpg" />
</a>
Javascript
$("#lightgallery").lightGallery({
selector: '.light-link'
});
Upvotes: 2