Skip to content

Instantly share code, notes, and snippets.

@imakewebthings
Created June 6, 2012 11:29
Show Gist options
  • Save imakewebthings/2881369 to your computer and use it in GitHub Desktop.
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
/* 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