title: slick.js on last slide show alert
body: <p>I'm using slick.js <a href="http://kenwheeler.github.io/slick/" rel="nofollow noreferrer">http://kenwheeler.github.io/slick/</a> to run through some slides, the last of which should toggle an alert.</p>
  
  <p>After some ferreting around online and realizing that this should work without having to hard code the number of slides (and having seen this solution: 
  <a href="https://stackoverflow.com/questions/28045086/slick-carousel-want-autoplay-to-play-the-slides-once-and-stop">Slick carousel. Want autoplay to play the slides once and stop</a> ), I've got the following code:</p>
  
  <pre><code>$(document).ready(function(){
            var item_length = $('.slider &gt; div').length - 1;
            $('.slider').slick({
              appendArrows : '.arrow-holder',
              adaptiveHeight : true,
              infinite : false,
              onAfterChange: function(){
                  if( item_length == slider.slickCurrentSlide() ){
                      alert("Slide 2");
                  };
              }
            }); 
          });
  </code></pre>
  
  <p>Unfortunately, nothing happens when I reach the last slide. Nor does it seem to if I do hard code in the last number, even taking into account the zero indexing.</p>
  
  <p>I have no errors or warnings in the console, so am struggling to work out how to figure out the problem.</p>