Jquery Flexslider Add And Remove Class On Slide Change
I'm using the jquery plugin Flexslider. I'm using the carousel as navigation for the slider. I'm trying to add a css class 'active' to the first carousel element when the page load
Solution 1:
Try adding a rel tag to the #clientthumbs li items and the #clienttestimonials li items and make sure they match. Then replace your start function with:
start : function(slider) {
$('#clientthumbs li').click(function(event) {
event.preventDefault();
$('#clientthumbs li').removeClass('active');
$(this).addClass('active');
$('.flexslider').show();
var slideTo = $(this).attr("rel"); //Grab rel value from link;
var slideToInt = parseInt(slideTo);
if (slider.currentSlide != slideToInt) {
$(this).addClass('active');
slider.flexAnimate(slideToInt) //Move the slider to the correct slide (Unless the slider is also already showing the slide we want);
}
}
});
Post a Comment for "Jquery Flexslider Add And Remove Class On Slide Change"