Skip to content

Instantly share code, notes, and snippets.

@Gpx
Forked from klmr/numbers.js
Created October 17, 2012 11:51
Show Gist options
  • Select an option

  • Save Gpx/3905127 to your computer and use it in GitHub Desktop.

Select an option

Save Gpx/3905127 to your computer and use it in GitHub Desktop.
Add slide numbers to Google’s html5slides
var createSlideNumbering = function (skipFirstN) {
var num = 0,
slides = $('.slides article'),
slidesNum = slides.length;
slides.each(function () {
var $this = $(this);
num += 1;
if (num <= skipFirstN)
return;
if ( $this.hasClass('nonumber') ) {
return;
}
jQuery('<div/>', {
'class': 'counter',
text: num + '/' + slidesNum
}).appendTo($this);
});
};
$(window).load(function () {
createSlideNumbering(2);
});
.counter {
bottom: 1em;
font-size: 0.5em;
position: absolute;
right: 1em;
z-index: 999;
}
.counter:before { content: '[ '; }
.counter:after { content: ' ]'; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment