Created
January 21, 2014 21:07
-
-
Save emaildano/8548390 to your computer and use it in GitHub Desktop.
Progress bar add on for FlexSlider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="progress_bar_container"> | |
<div class="progress_bar"></div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}); |
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
I have a small issue here, the progress bar doesn't start until the second slide. Any idea ? Thank you