Skip to content

Instantly share code, notes, and snippets.

@emaildano
Created January 21, 2014 21:07
Show Gist options
  • 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);
}
});
@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