带有 jQuery 1.11.3 的 lightGallery 1.2 显示无尽的微调器和 JS 错误,有什么问题吗?
lightGallery 1.2 with jQuery 1.11.3 shows endless spinner and JS error, what is wrong?
我使用 jquery 1.11.3 和 bower 安装的 lightgallery (https://github.com/sachinchoolur/lightGallery) 的新版本 1.2 进行了以下设置。我尝试了几种有和没有选择器的变体,例如以下,但始终打开画廊(确定),但在 JS 错误和旋转符号下方显示。这有什么问题?
// include the js and css ...
<script>
(function ($) {
$(document).ready(function () {
$('.multiSRC ul').lightGallery({
selector: "li"
});
});
})(jQuery);
</script>
和
<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>
发生此错误:
21:04:43.287 TypeError: src is undefined1 lightgallery.js:393:12
也就是
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9self\-]+)/i);
我做错了什么吗?还是 lightgallery 脚本中隐藏了一些错误?
选择器对象应具有 data-src/href
属性,并且 image/video 的版本 url 较大。因此您只需将选择器值更改为 li a
$('.multiSRC ul').lightGallery({
selector: "li a"
});
这是工作演示。 http://jsfiddle.net/amL2Lpqa/1/
我使用 jquery 1.11.3 和 bower 安装的 lightgallery (https://github.com/sachinchoolur/lightGallery) 的新版本 1.2 进行了以下设置。我尝试了几种有和没有选择器的变体,例如以下,但始终打开画廊(确定),但在 JS 错误和旋转符号下方显示。这有什么问题?
// include the js and css ...
<script>
(function ($) {
$(document).ready(function () {
$('.multiSRC ul').lightGallery({
selector: "li"
});
});
})(jQuery);
</script>
和
<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>
发生此错误:
21:04:43.287 TypeError: src is undefined1 lightgallery.js:393:12
也就是
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9self\-]+)/i);
我做错了什么吗?还是 lightgallery 脚本中隐藏了一些错误?
选择器对象应具有 data-src/href
属性,并且 image/video 的版本 url 较大。因此您只需将选择器值更改为 li a
$('.multiSRC ul').lightGallery({
selector: "li a"
});
这是工作演示。 http://jsfiddle.net/amL2Lpqa/1/