// requires Remy Sharp, http://remysharp.com/2009/01/26/element-in-view-event-plugin/
// slickInstance must be a slick variable with slick function.
// For eg. var slickInstance = $('.element').slick({ options })
$( '.element' ).bind( 'inview', function( event, visible ) { // use one instead of bind if you want to run only once
if ( visible ) { // or isInView parameter can also be used
// below code is used if you are adding any css animation on current slide.
// var $currentSlide = $( this ).find('.slick-current').removeClass('slick-current');
// setTimeout(function() {
// $currentSlide.addClass('slick-current');
// }, 100);
// add this settings in slick options too initially
slickInstance.slick( 'slickPlay' );
//$( slickInstance ).slick('slickSetOption', 'adaptiveHeight', true, true);
//$( slickInstance ).slick('slickSetOption', 'autoplay', true, true);
} else {
//$( slickInstance ).slick('slickSetOption', 'adaptiveHeight', false, true);
slickInstance.slick( 'slickPause' );
//$( slickInstance ).slick('slickSetOption', 'autoplay', false, true);
}
} );