照片库播放和暂停按钮

Photo Gallery Play and Pause Button

亲爱的朋友们。

我在这个站点找到了这个照片库:http://playgallery.siteseguro.ws/

我想使用它,但播放和暂停按钮没有任何作用。这些按钮不工作,我没有看到任何代码来实现它。

有可能使这项工作吗?下面是优化后的代码:

<html>
<head>
    <link rel="stylesheet" href="http://playgallery.siteseguro.ws/js/novagaleria/slick-bootstrap.css"/>
    <link rel="stylesheet" href="http://playgallery.siteseguro.ws/js/novagaleria/slick-style.css"/>
    <link rel='stylesheet' id='fontawesome-css' href='https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' type='text/css' media='all' />
</head>
<body>

<div class="col-slick-4">
      <div class="slick-gallery">

        <div class="slick-slider carousel-child" id="child-carousel" data-for=".carousel-parent" data-arrows="true" data-loop="false" data-dots="false" data-swipe="true" data-items="4" data-xs-items="4" data-sm-items="4" data-md-items="4" data-lg-items="5" data-slide-to-scroll="1">

           <div class="slick-item">
             <div class="thumb slick_thumb_rect">
               <div class="thumb__inner"><img src="http://playgallery.siteseguro.ws/images/s1.jpg"/>
               </div>
             </div>
           </div>
           <div class="slick-item">
             <div class="thumb slick_thumb_rect">
               <div class="thumb__inner"><img src="http://playgallery.siteseguro.ws/images/s2.jpg"/>
               </div>
             </div>
           </div>
           <div class="slick-item">
             <div class="thumb slick_thumb_rect">
               <div class="thumb__inner"><img src="http://playgallery.siteseguro.ws/images/s3.jpg"/>
               </div>
             </div>
           </div>
           <div class="slick-item">
             <div class="thumb slick_thumb_rect">
               <div class="thumb__inner"><img src="http://playgallery.siteseguro.ws/images/s4.jpg"/>
               </div>
             </div>
           </div>
           <div class="slick-item">
             <div class="thumb slick_thumb_rect">
               <div class="thumb__inner"><img src="http://playgallery.siteseguro.ws/images/s5.jpg"/>
               </div>
             </div>
           </div>
           <div class="slick-item">
             <div class="thumb slick_thumb_rect">
               <div class="thumb__inner"><img src="http://playgallery.siteseguro.ws/images/s6.jpg"/>
               </div>
             </div>
           </div>
        </div>

<div class="slick-controls">
    <div class="slick-controls-pause"><a href="" class="slick-play"><span class="fa fa-pause"></span></a></div>
    <div class="slick-controls-play"><a href="" class="slick-play"><span class="fa fa-play"></span></a></div>
</div><br><br>

        <div class="slick-slider carousel-parent" data-arrows="false" data-loop="false" data-dots="false" data-swipe="true" data-items="1" data-child="#child-carousel" data-for="#child-carousel" data-lightgallery="group">
          <div class="item"><img src="http://playgallery.siteseguro.ws/images/s1.jpg" alt="" height="480"/></div>
          <div class="item"><img src="http://playgallery.siteseguro.ws/images/s2.jpg" height="480" /></div>
          <div class="item"><img src="http://playgallery.siteseguro.ws/images/s3.jpg" alt="" height="480"/></div>
          <div class="item"><img src="http://playgallery.siteseguro.ws/images/s4.jpg" alt="" height="480"/></div>
          <div class="item"><img src="http://playgallery.siteseguro.ws/images/s5.jpg" alt="" height="480"/></div>
          <div class="item"><img src="http://playgallery.siteseguro.ws/images/s6.jpg" alt="" height="480"/></div>
        </div>

      </div>

</div> <!-- /col-slick-4 -->
    <script src="http://playgallery.siteseguro.ws/js/novagaleria/slick-core.min.js"></script>
    <script src="http://playgallery.siteseguro.ws/js/novagaleria/slick-script.js"></script>
</body>
</html>

你必须添加一些 jquery

$('.slick-slider').slick({
    slidesToShow: 1,
    slidesToScroll: 1,
    autoplay: true,
    pauseOnDotsHover:false,
    autoplaySpeed:500,
    dots: false,
    arrows: false,
    infinite: true
});

$('#pause').click(function() {
    $('.slick-slider').slick('slickPause');
});

$('#play').click(function() {
    $('.slick-slider').slick('slickPlay');
});

然后编辑您的按钮,使其分别具有暂停和播放的 ID,并删除 a 标签

<div class="slick-controls">
    <div class="slick-controls-pause slick-play"><span id="pause" class="fa fa-pause"></span></div>
    <div class="slick-controls-play slick-play"><span id="play" class="fa fa-play"></span></div>
</div><br><br>

如果你想让指针悬停。而不是使用标签。在 .slick-play

上使用 cursor: pointer;