Javascript 无法读取未定义[Galleria-1.4.2.js]的属性“length”
我的控制台中出现以下错误:Javascript 无法读取未定义[Galleria-1.4.2.js]的属性“length”,javascript,jquery,image-gallery,galleria,Javascript,Jquery,Image Gallery,Galleria,我的控制台中出现以下错误: Uncaught TypeError: Cannot read property 'length' of undefined galleria-1.4.2.min.js:2 尝试使用Galleria.io,版本1.4.2和基本的经典主题。我确实包含了jQuery v1.10.2和以下代码,这些代码应该是使galleria image gallery正常工作的基本代码: <script src="galleria/galleria-1.4.2.min.j
Uncaught TypeError: Cannot read property 'length' of undefined galleria-1.4.2.min.js:2
尝试使用Galleria.io,版本1.4.2和基本的经典主题。我确实包含了jQuery v1.10.2和以下代码,这些代码应该是使galleria image gallery正常工作的基本代码:
<script src="galleria/galleria-1.4.2.min.js"></script>
<script>
Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js');
Galleria.run('.galleria', {responsive: true, height: 0.724, lightbox: true});
</script>
即使我将选项留空。我也在使用BootstrapV3,如果这可能与它有关的话
选择器是一个类而不是一个ID,但我在示例代码中看到了它,所以它不成问题。我在一个页面上有多个小图像库,所以0、1或更多,所以使用ID不是一个好的选择。我的申请确实需要这个
提前感谢您的帮助。大家好,Galleria用户。你的问题是
Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js');
您必须确保在安装之前加载它
Galleria.run('.galleria', {responsive: true, height: 0.724, lightbox: true});
被称为
为此,我在Galleria.js之后的标题中加载了主题。
我在包含图片的Galleria容器之后的脚本标记中调用Galleria.run命令
Galleria.run('.galleria', {responsive: true, height: 0.724, lightbox: true});