From 2f8aa51dc2ace00bdc72926df3b8313626c2e38f Mon Sep 17 00:00:00 2001 From: tkaczmarzyk Date: Sat, 6 Apr 2013 18:18:54 +0200 Subject: simplified getCurrentFragmentIndex impl --- js/reveal.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'js/reveal.js') diff --git a/js/reveal.js b/js/reveal.js index 9a26a23..9b7b196 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2047,21 +2047,12 @@ var Reveal = (function(){ // Returns an index (1-based) of the current fragment getCurrentFragmentIndex : function() { - var visibleFragments; - - // vertical slides: - if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) { - visibleFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' ); - } - // Horizontal slides: - else { - visibleFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' ); - } - - if( visibleFragments.length) { - return visibleFragments.length; - } else { - return undefined; + if( currentSlide ) { + var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' ); + + if( visibleFragments ) { + return visibleFragments.length; + } } }, -- cgit v1.2.3