光滑的旋转木马接下来和前箭头不能正常工作

时间:2017-06-15 02:55:30

标签: jquery html css

我正在使用光滑的旋转木马插件,下一个箭头根本不起作用,上一个箭头就像下一个箭头一样工作。有人能帮我吗?

<div class="slickcarousel">
      <div><img src = "Nature Photos/Hope.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "https://www.smashingmagazine.com/wp-content/uploads/2015/06/10-dithering-opt.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider1.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "http://i.dailymail.co.uk/i/pix/2017/03/13/13/3E39C90700000578-4308866-image-m-5_1489410821924.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "http://phototheque.pasteur.fr/images/slideshow/image-9.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "Nature Photos/Hope.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "https://www.smashingmagazine.com/wp-content/uploads/2015/06/10-dithering-opt.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "Nature Photos/Hope.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
      <div><img src = "http://phototheque.pasteur.fr/images/slideshow/image-9.jpg" class="img-responsive" alt = "BlackProPix Photography" height = "160px" width = "176px"></div>
    </div>

$('.slickcarousel').slick({
                   infinite: true,
                    slidesToShow: 4,
                    slidesToScroll: 1,
                    centerMode: true,
                    autoplay: true,
                    autoplaySpeed: 2000,
                    pauseOnHover: true
                });

3 个答案:

答案 0 :(得分:1)

确保正确定义所有参考文件?示例如下:

  

slick-theme.min.css AND slick.min.css&gt;加载jQuery&gt; slick.min.js

设置宽度,如width: 90%;,为Next / Prev按钮留出一些空间

$('.slickcarousel').slick({
  infinite: true,
  slidesToShow: 4,
  slidesToScroll: 1,
  centerMode: true,
  autoplay: true,
  autoplaySpeed: 2000,
  pauseOnHover: true
});
body {
  background: black;
}
.slickcarousel {
  margin: 0 auto;
  padding: 15px;
  width: 90%;
  color: #333;
  background: #419be0;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js"></script>


<div class="slickcarousel">
  <div><img src="Nature Photos/Hope.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="https://www.smashingmagazine.com/wp-content/uploads/2015/06/10-dithering-opt.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider1.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="http://i.dailymail.co.uk/i/pix/2017/03/13/13/3E39C90700000578-4308866-image-m-5_1489410821924.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="http://phototheque.pasteur.fr/images/slideshow/image-9.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="Nature Photos/Hope.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="https://www.smashingmagazine.com/wp-content/uploads/2015/06/10-dithering-opt.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="Nature Photos/Hope.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
  <div><img src="http://phototheque.pasteur.fr/images/slideshow/image-9.jpg" class="img-responsive" alt="BlackProPix Photography" height="160px" width="176px"></div>
</div>

答案 1 :(得分:1)

检查控制台,显示错误,请添加

答案 2 :(得分:0)

希望对您有所帮助。

$('.banner_slide').slick({
    infinite: true,
    autoplay: false,
    autoplaySpeed: 1000,
    speed: 600,
    slidesToShow: 1,
    slidesToScroll: 1,
    pauseOnHover: true,
    cssEase: 'linear',
    draggable: true,
    dots: false,
    prevArrow: false,
    nextArrow: false
    arrows: true (remove the prevArrow, nextArrow options)
});

请在jQuery脚本中插入prevArrownextArrow选项。

谢谢