allow to be called directly before or after (closes #2021)

edit
Hakim El Hattab 2017-11-09 10:26:35 +01:00
parent 4a4719b587
commit 3beda63a7d
1 changed files with 13 additions and 5 deletions

View File

@ -461,6 +461,8 @@
*/ */
function start() { function start() {
loaded = true;
// Make sure we've got all the DOM elements we need // Make sure we've got all the DOM elements we need
setupDOM(); setupDOM();
@ -488,8 +490,6 @@
// Enable transitions now that we're loaded // Enable transitions now that we're loaded
dom.slides.classList.remove( 'no-transition' ); dom.slides.classList.remove( 'no-transition' );
loaded = true;
dom.wrapper.classList.add( 'ready' ); dom.wrapper.classList.add( 'ready' );
dispatchEvent( 'ready', { dispatchEvent( 'ready', {
@ -1014,14 +1014,22 @@
*/ */
function configure( options ) { function configure( options ) {
var numberOfSlides = dom.wrapper.querySelectorAll( SLIDES_SELECTOR ).length; var oldTransition = config.transition;
dom.wrapper.classList.remove( config.transition );
// New config options may be passed when this method // New config options may be passed when this method
// is invoked through the API after initialization // is invoked through the API after initialization
if( typeof options === 'object' ) extend( config, options ); if( typeof options === 'object' ) extend( config, options );
// Abort if reveal.js hasn't finished loading, config
// changes will be applied automatically once loading
// finishes
if( loaded === false ) return;
var numberOfSlides = dom.wrapper.querySelectorAll( SLIDES_SELECTOR ).length;
// Remove the previously configured transition class
dom.wrapper.classList.remove( oldTransition );
// Force linear transition based on browser capabilities // Force linear transition based on browser capabilities
if( features.transforms3d === false ) config.transition = 'linear'; if( features.transforms3d === false ) config.transition = 'linear';