Skip to content

Instantly share code, notes, and snippets.

@emaildano
Created January 21, 2014 21:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emaildano/8548390 to your computer and use it in GitHub Desktop.
Save emaildano/8548390 to your computer and use it in GitHub Desktop.
Progress bar add on for FlexSlider
<div class="progress_bar_container">
<div class="progress_bar"></div>
</div>
var slider = $('#introSlider');
slider.flexslider({
animation: "slide",
directionNav: false,
slideshow: true,
slideshowSpeed: 8000,
animationSpeed: 1500,
start: function(slider){
//initial load
positionSlide();
$(window).resize(positionSlide);
$('#introSlider .slides > li').fadeIn(350);
$('.caption').fadeIn(350);
$('body').removeClass('loading');
var progressBar = $('.progress_bar');
progressBar.animate({'width': "100%"}, 8000, function(){
$(this).css({'width' : 0})
});
$(".flex-control-paging li a").on("click", function(){
$('.progress_bar_container').fadeOut(300);
});
// setTimeout(function(){
// $('.caption').fadeOut(500);
// }, 8000)
},
before: function(){
//fires with each slide transition
$('.caption').fadeOut(500);
$('.progress_bar').animate({'width': "100%"}, 8000, function(){
$(this).css({'width' : 0})
});
},
after: function(){
//firs after each slide completes
$('.caption').fadeIn(350);
}
});
@jesperlandberg
Copy link

Been looking for this! Awesome!

Just one issue for me tho, the loading bar doesn't start until all my slider goes for the "second spin", after the images have been shown one time already, you know why this is?

@tucq88
Copy link

tucq88 commented Jan 6, 2015

I cant find define of function positionSlide() :( please help

@mstroiu
Copy link

mstroiu commented Apr 15, 2015

I have a small issue here, the progress bar doesn't start until the second slide. Any idea ? Thank you

@coolseed
Copy link

In your css initiate the width to 0 along your other styles if you have:
.progress_bar { width: 0; }

That worked for me.

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