i'm using slick's "slider syncing" feature, , if slidestoshow == total number of slides, .slick-current class in nav not shifted when top carousel slid.
here's html:
<div class="slider slider-for"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> <div class="slider slider-nav"> <div><p>1</p></div> <div><p>2</p></div> <div><p>3</p></div> <div><p>4</p></div> </div> here's relevant js:
jquery('.example2 .slider-for').slick({ slidestoshow: 1, slidestoscroll: 1, asnavfor: '.example2 .slider-nav' }); jquery('.example2 .slider-nav').slick({ slidestoshow: 4, slidestoscroll: 1, asnavfor: '.example2 .slider-for', centermode: false, focusonselect: true }); jsfiddle demonstrating problem here: http://jsfiddle.net/xd2h934n/
how can .slick-current class moved in case?
this keeps getting marked fixed on github, still doesn't work.
this js should it:
var slides = $(".slider-for .slick-track > .slick-slide").length; $('.slider-for').on('afterchange', function(event, slick, currentslide, nextslide){ var infocus = $('.slider-for .slick-current').attr('data-slick-index'); $('.slider-nav .slick-current').removeclass('slick-current'); $('.slider-nav .slick-slide[data-slick-index="' + infocus + '"]').addclass('slick-current'); });
Comments
Post a Comment