Skip to content

Instantly share code, notes, and snippets.

@jayllellis
Last active February 8, 2020 13:04
Show Gist options
  • Save jayllellis/a4e433b5c8b56514a6d6 to your computer and use it in GitHub Desktop.
Save jayllellis/a4e433b5c8b56514a6d6 to your computer and use it in GitHub Desktop.
Add a class to current slide in bxSlider
$('.top-slider').bxSlider({
onSliderLoad: function(currentIndex) {
$('.top-slider').children().eq(currentIndex).addClass('active-slide');
},
onSlideAfter: function($slideElement){
$('.top-slider').children().removeClass('active-slide');
$slideElement.addClass('active-slide');
}
});
@malohtie
Copy link

malohtie commented Jun 5, 2018

not working it dosent remove the previous class
and on load not marked as active slide

@jayllellis
Copy link
Author

Oh, thanks. I updated it - the slide index didn't need to be incremented on load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment