1
0
Fork 0

don't style html element if reveal.js is embedded

This commit is contained in:
Hakim El Hattab 2020-04-06 14:35:48 +02:00
parent 3a7f210631
commit f24620018f
4 changed files with 18 additions and 14 deletions

View File

@ -11,7 +11,7 @@
* GLOBAL STYLES * GLOBAL STYLES
*********************************************/ *********************************************/
html { html.reveal-full-page {
width: 100%; width: 100%;
height: 100%; height: 100%;
height: 100vh; height: 100vh;

2
dist/reveal.css vendored

File diff suppressed because one or more lines are too long

2
dist/reveal.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -137,14 +137,25 @@ export default function( revealElement, options ) {
dom.wrapper = revealElement; dom.wrapper = revealElement;
dom.slides = revealElement.querySelector( '.slides' ); dom.slides = revealElement.querySelector( '.slides' );
// Force a layout when the whole page, incl fonts, has loaded
window.addEventListener( 'load', layout, false );
// Copy options over to our config object // Copy options over to our config object
config = { ...defaultConfig, ...options, ...getQueryHash() }; config = { ...defaultConfig, ...options, ...getQueryHash() };
// Embedded decks use the reveal element as their viewport
if( config.embedded === true ) {
revealElement.classList.add( 'reveal-viewport' );
}
// Non-embedded decks cover the full page and use the body
// as their viewport
else {
document.body.classList.add( 'reveal-viewport' );
document.documentElement.classList.add( 'reveal-full-page' );
}
// Force a layout when the whole page, incl fonts, has loaded
window.addEventListener( 'load', layout, false );
// Load plugins then move on to #start() // Load plugins then move on to #start()
plugins.load( config.dependencies ).then( start ) plugins.load( config.dependencies ).then( start );
return new Promise( resolve => Reveal.addEventListener( 'ready', resolve ) ); return new Promise( resolve => Reveal.addEventListener( 'ready', resolve ) );
@ -230,13 +241,6 @@ export default function( revealElement, options ) {
dom.wrapper.classList.remove( 'no-hover' ); dom.wrapper.classList.remove( 'no-hover' );
} }
if( config.embedded === true ) {
revealElement.classList.add( 'reveal-viewport' );
}
else {
document.body.classList.add( 'reveal-viewport' );
}
backgrounds.render(); backgrounds.render();
slideNumber.render(); slideNumber.render();
controls.render(); controls.render();