aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-29 13:40:55 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-29 13:40:55 +0200
commit1b236bdf211ac2a9600a89fe4efae9619193a410 (patch)
treef851355a5f2222c0cb6808989e58bd1987f6d3d0 /js
parent2ac0a55ccf0e8f881ff48f3500865bff37ec6fa3 (diff)
downloadfreenode-live-2017-presentation-1b236bdf211ac2a9600a89fe4efae9619193a410.tar
freenode-live-2017-presentation-1b236bdf211ac2a9600a89fe4efae9619193a410.tar.gz
wait for document to load before triggering pdf layout
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 6e6c12b..49b2e7c 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -360,12 +360,6 @@
// Update all backgrounds
updateBackground( true );
- // Special setup and config is required when printing to PDF
- if( isPrintingPDF() ) {
- removeEventListeners();
- setupPDF();
- }
-
// Notify listeners that the presentation is ready but use a 1ms
// timeout to ensure it's not fired synchronously after #initialize()
setTimeout( function() {
@@ -381,6 +375,20 @@
} );
}, 1 );
+ // Special setup and config is required when printing to PDF
+ if( isPrintingPDF() ) {
+ removeEventListeners();
+
+ // The document needs to have loaded for the PDF layout
+ // measurements to be accurate
+ if( document.readyState === 'complete' ) {
+ setupPDF();
+ }
+ else {
+ window.addEventListener( 'load', setupPDF );
+ }
+ }
+
}
/**