FlexSlider 2 resizing on window resize
You probably have a solution or have moved on at this stage but I thought I'd point out this issue on github for visitors: https://github.com/woothemes/FlexSlider/issues/391 (note patbouche's answer). This solution worked for me. I put it in the after:
callback.
var slider1 = $('#slider1').data('flexslider');
slider1.resize();
I had to bind the window resize event in order to get this working reliably. Since the FlexSlider before and after callbacks did not work for me:
$(window).bind('resize', function() {
setTimeout(function(){
var slider = $('#banner').data('flexslider');
slider.resize();
}, 1000);
});
I think it is better to put it into before callback:
$('.flexslider').flexslider({
// your settings
before: function(slider){
$('.flexslider').resize();
}
});
I combined a couple of these solutions and also added a check to make sure the slider existed on the page first.
$(function() {
var resizeEnd;
$(window).on('resize', function() {
clearTimeout(resizeEnd);
resizeEnd = setTimeout(function() {
flexsliderResize();
}, 250);
});
});
function flexsliderResize(){
if ($('.flexslider').length > 0) {
$('.flexslider').data('flexslider').resize();
}
}