From 9947b7a5324c9783de43f867c1f7a3ac0687144f Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 1 Apr 2014 09:12:41 +0200 Subject: add getTotalSlides #858 --- js/reveal.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js/reveal.js') diff --git a/js/reveal.js b/js/reveal.js index 5eb377b..fc0a2c0 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2392,6 +2392,15 @@ var Reveal = (function(){ } + /** + * Retrieves the total number of slides in this presentation. + */ + function getTotalSlides() { + + return document.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ).length; + + } + /** * Retrieves the current state of the presentation as * an object. This state can then be restored at any @@ -3457,6 +3466,8 @@ var Reveal = (function(){ // Returns the indices of the current, or specified, slide getIndices: getIndices, + getTotalSlides: getTotalSlides, + // Returns the slide at the specified index, y is optional getSlide: function( x, y ) { var horizontalSlide = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ]; -- cgit v1.2.3