如何在光滑的灯箱中禁用无限循环?

时间:2018-10-31 10:23:49

标签: javascript jquery slick.js

我正在使用滑动灯箱插件https://github.com/jongacnik/slick-lightbox。 我有一个图片库。 我现在正在尝试这样做:-

$('.slider-lightbox').slickLightbox({
    navigateByKeyboard: true,
    slick:{infinite:'false'}
});

但这不会禁用无限循环。

HTML代码

<div class="image-gallery-content">
    <ul class="slider-lightbox">
        <li class="video active">
            <a href="https://www.youtube.com/watch?v=KCI8Wb4KTG8" width="400px" target="_blank">
               <img src="images/community/img2.jpg" alt="">
            </a>
            <img class="play-btn" src="images/video-icon.png">
        </li>
        <li class="image active">
            <a href="images/community/img3.jpg" target="_blank">
               <img src="images/community/img3.jpg" alt="">
            </a>
        </li>
        <li class="image active">
            <a href="images/community/img1.jpg" target="_blank">
               <img src="images/community/img1.jpg" alt="">
            </a>
        </li>
    </ul>
</div>

1 个答案:

答案 0 :(得分:3)

您需要将正确的(=布尔值)false传递给slick,而不是字符串'false'

$('.slider-lightbox').slickLightbox({
    navigateByKeyboard: true,
    slick: {infinite:false}
});