Created
June 6, 2012 11:29
-
-
Save imakewebthings/2881369 to your computer and use it in GitHub Desktop.
Super quick and dirty, maybe not even functional, progress bar example for deck.js
This file contains 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
/* Add this to bottom of deck container | |
<div class="deck-progress"><span></span></div> | |
And add this CSS wherever: | |
.deck-progress { | |
position:absolute; | |
left:0; | |
right:0; | |
bottom:0; | |
height:5px; | |
background:#000; | |
} | |
.deck-progress span { | |
position:absolute; | |
left:0; | |
top:0; | |
height:5px; | |
background:#77f; | |
width:0px; | |
-webkit-transition:width 500ms ease-in-out: | |
-moz-transition:width 500ms ease-in-out: | |
-ms-transition:width 500ms ease-in-out: | |
-o-transition:width 500ms ease-in-out: | |
transition:width 500ms ease-in-out: | |
} | |
*/ | |
$(document).bind('deck.change', function(event, from, to) { | |
// If this were made into a real plugin, these hard coded | |
// things should be options, but this is quick and dirty | |
var width = to / ($.deck('getSlides').length - 1) * 100; | |
$('.deck-progress span').css('width', width + '%'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment