diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-01-28 08:33:50 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-01-28 08:33:50 +0100 |
commit | 64e72781b4d576a2a32e7c4b3e1692d03a182c7d (patch) | |
tree | 90b9cec62f338a709051afbb96530e2f363a4dc0 /js | |
parent | c8569e2d9ff675b806e5d5bf94ba1a07d121e74b (diff) | |
download | fosdem-2018-presentation-64e72781b4d576a2a32e7c4b3e1692d03a182c7d.tar fosdem-2018-presentation-64e72781b4d576a2a32e7c4b3e1692d03a182c7d.tar.gz |
ensure overview indices are up to date if a slide moves
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/js/reveal.js b/js/reveal.js index 37c6831..9ed7b7e 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1664,24 +1664,11 @@ // that the same scaling is applied dom.slides.appendChild( dom.background ); - // Bind events so that clicking on a slide navigates to it - toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) { - - hslide.setAttribute( 'data-index-h', h ); - - if( hslide.classList.contains( 'stack' ) ) { - toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { - - vslide.setAttribute( 'data-index-h', h ); - vslide.setAttribute( 'data-index-v', v ); - vslide.addEventListener( 'click', onOverviewSlideClicked, true ); - - } ); - } - else { - hslide.addEventListener( 'click', onOverviewSlideClicked, true ); + // Clicking on an overview slide navigates to it + toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( function( slide ) { + if( !slide.classList.contains( 'stack' ) ) { + slide.addEventListener( 'click', onOverviewSlideClicked, true ); } - } ); updateSlidesVisibility(); @@ -1718,11 +1705,15 @@ // Layout slides toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) { + hslide.setAttribute( 'data-index-h', h ); transformElement( hslide, 'translate3d(' + ( h * slideWidth ) + 'px, 0, 0)' ); if( hslide.classList.contains( 'stack' ) ) { toArray( hslide.querySelectorAll( 'section' ) ).forEach( function( vslide, v ) { + vslide.setAttribute( 'data-index-h', h ); + vslide.setAttribute( 'data-index-v', v ); + transformElement( vslide, 'translate3d(0, ' + ( v * slideHeight ) + 'px, 0)' ); } ); @@ -1997,7 +1988,7 @@ // If no vertical index is specified and the upcoming slide is a // stack, resume at its previous vertical index - if( v === undefined ) { + if( v === undefined && !isOverview() ) { v = getPreviousVerticalIndex( horizontalSlides[ h ] ); } |