gpt4 book ai didi

javascript - Lightgallery 哈希插件中有多个画廊?

转载 作者:行者123 更新时间:2023-11-27 23:54:35 25 4
gpt4 key购买 nike

我无法运行 Lightgallery 哈希插件。我的愿望是在同一页面上有两个画廊,单击一个按钮应该显示另一个画廊。如果我没记错的话,插件应该这样做。

我添加了这个 HTML 结构:

<div id="hash">
<a href="img/img_port/reportage/img-1.jpg">
<img src="img/img_port/reportage/thumb-1.jpg" />
</a>
<a href="img/img_port/reportage/img-2.jpg">
<img src="img/img_port/reportage/thumb-2.jpg" />
</a>
<a href="img/img_port/reportage/img-3.jpg">
<img src="img/img_port/reportage/thumb-3.jpg" />
</a>
<a href="img/img_port/reportage/img-4.jpg">
<img src="img/img_port/reportage/thumb-4.jpg" />
</a>

<div id="hash2">   
<a href="img/img_port/reportage/img-1.jpg">
<img src="img/img_port/reportage/thumb-1.jpg" />
</a>
<a href="img/img_port/reportage/img-2.jpg">
<img src="img/img_port/reportage/thumb-2.jpg" />
</a>
<a href="img/img_port/reportage/img-3.jpg">
<img src="img/img_port/reportage/thumb-3.jpg" />
</a>
<a href="img/img_port/reportage/img-4.jpg">
<img src="img/img_port/reportage/thumb-4.jpg" />
</a>

还有这个 JavaScript:

<script type="text/javascript">
$(document).ready(function() {
$("#hash").lightGallery({
download: false,
counter: false,
hash: true;
galleryId: 1
});
$("#hash2").lightGallery({
download: false,
counter: false,
hash: true;
galleryId: 2
});
});
</script>

这是正确的还是错误的?

最佳答案

<script type="text/javascript">
$(document).ready(function() {
$("#hash").lightGallery({
download: false,
counter: false,
hash: true, /*Here is the error.*/
galleryId: 1
});
$("#hash2").lightGallery({
download: false,
counter: false,
hash: true,/*Here is the error.*/
galleryId: 2
});
});
</script>

关于javascript - Lightgallery 哈希插件中有多个画廊?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32377080/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com