How do I manually jump to a specific slide in Flexslider?
June 25, 2014
This is such a quick fix, yet very few places on the internet seem to know the 4 lined solution to this problem. If you are using the FlexSlider plugin, you may come across the scenario where you need to jump to a specific slide – no animations attatched. Just a good old fashioned goTo action. I found that while my other search terms failed, looking for changing the flexslider settings after initialization had something to it.
This is how i initialized my flexslider:
$('#whyslider').flexslider({
animation: "slide",
slideshow: false,
animationLoop:true
});
[cta id=’1682′]
Later in the code when i wanted to jump to a slide:
var slider = $('#whyslider').data('flexslider');
var animationSpeed = slider.vars.animationSpeed; //save animation speed to reset later
slider.vars.animationSpeed = 0;
slider.flexAnimate(3); //position index for desired slide goes here
slider.vars.animationSpeed = animationSpeed;