title: Slick Carousel target active slide to add and remove animation classes
body: <p>I am trying to target the <code>active slide</code> in my <code>slick carousel</code> by ken wheeler to add an animation to the p element within that slide. </p>
  
  <p>So, when the <code>slide</code> is active, the <code>p</code> element will bounce in (or something), then when the slide transitions to the next slide, the animation will be applied to the new p element. After the slides have looped, the animated class will be continuously applied to the <code>slick carousel</code>.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div class="slick-promo"&gt;
      &lt;div class="single-slide"&gt;[img code here]&lt;p&gt;This text will come in animated, then as the slide leaves it will have the animation class removed.&lt;/p&gt;&lt;/div&gt;
      &lt;div class="single-slide"&gt;[img code here]&lt;p&gt;Lorem ipsum blah blah&lt;/p&gt;&lt;/div&gt;
      &lt;div class="single-slide"&gt;[img code here]&lt;p&gt;lorem ipsum blah blah&lt;/p&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The <code>images</code> and several <code>classes</code> are dynamically generated by other programs I use. </p>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>jQuery(document).ready(function($){
      $('.slick-promo').slick({
        infinite: true,
        fade: true,
        cssEase: 'linear',
        slidesToShow: 1,
        slidesToScroll: 1,
        autoplay: true,
        autoplaySpeed: 2000,
        //this is where I need help
        onAfterChange:function(slider,index){
              $('.slick-active p').toggleClass('animated bounce');
        }
      });
  });
  </code></pre>
  
  <p>The <code>.slick-active</code> class is dynamically generated by the <code>slick carousel</code>. I am targeting the <code>p</code> element in the above HTML code. The <code>animated bounce</code> classes are tied to css that generate the animation.</p>
  
  <p>I am very new to <code>Javascript/jQuery</code>, so my mistake could be elementary. I have searched the web for many hours now trying to find out what I need to do...</p>