simplify how data-autoslide is picked up from fragments #766
parent
ed4cdaf9e7
commit
a97d73167d
10
js/reveal.js
10
js/reveal.js
|
@ -1456,6 +1456,7 @@ var Reveal = (function(){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function toggleAutoSlide( override ) {
|
function toggleAutoSlide( override ) {
|
||||||
|
|
||||||
if( typeof override === 'boolean' ) {
|
if( typeof override === 'boolean' ) {
|
||||||
override ? resumeAutoSlide() : pauseAutoSlide();
|
override ? resumeAutoSlide() : pauseAutoSlide();
|
||||||
}
|
}
|
||||||
|
@ -2500,14 +2501,9 @@ var Reveal = (function(){
|
||||||
|
|
||||||
if( currentSlide ) {
|
if( currentSlide ) {
|
||||||
|
|
||||||
var fragmentAutoSlide = null;
|
var currentFragment = currentSlide.querySelector( '.current-fragment' );
|
||||||
// it is assumed that any given data-autoslide value (for each of the current fragments) can be chosen
|
|
||||||
toArray( Reveal.getCurrentSlide().querySelectorAll( '.current-fragment' ) ).forEach( function( el ) {
|
|
||||||
if( el.hasAttribute( 'data-autoslide' ) ) {
|
|
||||||
fragmentAutoSlide = el.getAttribute( 'data-autoslide' );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
var fragmentAutoSlide = currentFragment ? currentFragment.getAttribute( 'data-autoslide' ) : null;
|
||||||
var parentAutoSlide = currentSlide.parentNode ? currentSlide.parentNode.getAttribute( 'data-autoslide' ) : null;
|
var parentAutoSlide = currentSlide.parentNode ? currentSlide.parentNode.getAttribute( 'data-autoslide' ) : null;
|
||||||
var slideAutoSlide = currentSlide.getAttribute( 'data-autoslide' );
|
var slideAutoSlide = currentSlide.getAttribute( 'data-autoslide' );
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -63,6 +63,10 @@ Reveal.addEventListener( 'ready', function() {
|
||||||
Reveal.configure({ autoSlide: 10000 });
|
Reveal.configure({ autoSlide: 10000 });
|
||||||
strictEqual( Reveal.isAutoSliding(), true, 'true after starting' );
|
strictEqual( Reveal.isAutoSliding(), true, 'true after starting' );
|
||||||
|
|
||||||
|
Reveal.toggleAutoSlide();
|
||||||
|
strictEqual( Reveal.isAutoSliding(), false, 'false after toggling' );
|
||||||
|
Reveal.toggleAutoSlide();
|
||||||
|
|
||||||
Reveal.configure({ autoSlide: 0 });
|
Reveal.configure({ autoSlide: 0 });
|
||||||
strictEqual( Reveal.isAutoSliding(), false, 'false after setting to 0' );
|
strictEqual( Reveal.isAutoSliding(), false, 'false after setting to 0' );
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue