From 11fc906add845d8dd2b1d2ea1d902d8e12a65fb9 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sun, 3 Feb 2013 15:55:22 -0500 Subject: helper method for retrieving slide based on index (closes #293) --- js/reveal.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'js/reveal.js') diff --git a/js/reveal.js b/js/reveal.js index a9890ca..52d2c7b 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1829,6 +1829,18 @@ var Reveal = (function(){ // Returns the indices of the current, or specified, slide getIndices: getIndices, + // Returns the slide at the specified index, y is optional + getSlide: function( x, y ) { + var horizontalSlide = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ]; + var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' ); + + if( typeof y !== 'undefined' ) { + return verticalSlides ? verticalSlides[ y ] : undefined; + } + + return horizontalSlide; + }, + // Returns the previous slide element, may be null getPreviousSlide: function() { return previousSlide; -- cgit v1.2.3