简体   繁体   English

光滑滑块在幻灯片中附加点

[英]Slick slider appendDots inside a slide

I have added slick slider to create a slider on my site. 我添加了光滑的滑块以在我的网站上创建滑块。 Got the dots working and appended them inside a slide as its the only way to get them in the position I want them but now the active state isn't working on the dots. 得到点工作并将它们附加到幻灯片中,因为它是将它们放在我想要的位置的唯一方法,但现在活动状态不在点上。

Probably because it is getting included for as many slides as there is. 可能是因为它被包含在尽可能多的幻灯片中。 Anyone help me with this? 有人帮我这个吗?

$(document).ready(function() {
  $('.main-slider').slick({
    infinite: true,
    slidesToShow: 1,
    slidesToScroll: 1,
    dots: true,
    appendDots: '.appendDots',
  });
});
<div class="flex-center" style="background-image: url('http://lorempixel.com/1900/400')">
  <div class="flex-inner">
    <div class="container">
      <div class="flex-content">
        <div class="col-md-12">
          <div class="appendDots"></div>
        </div>
        <div class="col-md-12">
          <h2>Distributor of commercial vehicle parts &amp; Accessories</h2>
          <p>To fit European truck &amp; trailers</p>
        </div>

        <div class="col-md-12">
          <a class="button button-background" href="#">Shop Now <span class='glyphicon glyphicon-circle-arrow-right'></span></a>
        </div>
      </div>
    </div>
  </div>
</div>

Thank you in advance for any answers. 提前感谢您的任何答案。

From the documentation slick is expecting a (Selector, htmlString, Array, Element, jQuery object) so you should do something like this. 从文档光滑期望(Selector,htmlString,Array,Element,jQuery对象)所以你应该做这样的事情。

$(document).ready(function() {
  $('.main-slider').slick({
    infinite: true,
    slidesToShow: 1,
    slidesToScroll: 1,
    dots: true,
    appendDots: $('.appendDots'),
  });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM