小编jts*_*ama的帖子

Slick Carousel目标活动幻灯片添加和删除动画类

我试图将active slideslick carousel的ken wheeler中的目标添加到幻灯片中的p元素中.

因此,当slide激活时,p元素将反弹(或某种东西),然后当幻灯片转换到下一张幻灯片时,动画将应用于新的p元素.幻灯片循环后,动画类将继续应用于slick carousel.

HTML:

<div class="slick-promo">
    <div class="single-slide">[img code here]<p>This text will come in animated, then as the slide leaves it will have the animation class removed.</p></div>
    <div class="single-slide">[img code here]<p>Lorem ipsum blah blah</p></div>
    <div class="single-slide">[img code here]<p>lorem ipsum blah blah</p></div>
</div>
Run Code Online (Sandbox Code Playgroud)

images几个classes是由我使用的其他程序动态生成的.

使用Javascript:

jQuery(document).ready(function($){
    $('.slick-promo').slick({
      infinite: true,
      fade: true,
      cssEase: 'linear',
      slidesToShow: 1,
      slidesToScroll: 1,
      autoplay: true,
      autoplaySpeed: 2000,
      //this is where …
Run Code Online (Sandbox Code Playgroud)

javascript jquery carousel toggleclass slick.js

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

carousel ×1

javascript ×1

jquery ×1

slick.js ×1

toggleclass ×1