jquery - Multiple flexslider remove current slide -
i'm trying remove current slide flexslider on page multiple sliders share same class. http://flexslider.woothemes.com/
what if click on close link remove current slide on 2nd flexslider, removes current slide 1st flexslider.
i need correctly remove current slide on respective sliders. ideas?
html
<!-- flexslider 1 --> <section class='choices'> <ul class='slides'> <li class='flex-active-slide'> <a class='close'></a> content here </li> <li> <a class='close'></a> content here </li> <li> <a class='close'></a> content here </li> </ul> </section> <!-- flexslider 2 --> <section class='choices'> <ul class='slides'> <li class='flex-active-slide'> <a class='close'></a> content here </li> <li> <a class='close'></a> content here </li> </ul> </section>
script
(window).load(function() { $('.choices').flexslider({ animation: "slide", }); var slider = $('.choices').data('flexslider'); $('.slides .close').click(function(){ slider.removeslide(slider.currentslide); }); });
manage found workaround, currentslide homecoming slide index number. requires more specific selector.
$('.choices .close').click(function(){ var sliderid = $(this).closest(".choices"); var slider = sliderid.data('flexslider'); slider.removeslide(slider.currentslide); });
jquery flexslider
No comments:
Post a Comment