diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-10-17 00:20:42 -0400 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-10-17 00:20:42 -0400 |
commit | 3a2036e2b20fa13bc92f4fdecc0b17342c4f8204 (patch) | |
tree | c32245fa70e9cf8f75286214597bfd8d766347c2 | |
parent | f70dcd3c9f26c09169d8f58443898661d9fea179 (diff) | |
download | fosdem-2018-presentation-3a2036e2b20fa13bc92f4fdecc0b17342c4f8204.tar fosdem-2018-presentation-3a2036e2b20fa13bc92f4fdecc0b17342c4f8204.tar.gz |
add 'ready' event (#182)
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | js/reveal.js | 9 | ||||
-rw-r--r-- | js/reveal.min.js | 10 |
3 files changed, 23 insertions, 6 deletions
@@ -154,6 +154,16 @@ Reveal.addEventListener( 'somestate', function() { }, false ); ``` +### Ready event + +The 'ready' event is fired when reveal.js has loaded all (synchronous) dependencies and is ready to start navigating. + +```javascript +Reveal.addEventListener( 'ready', function( event ) { + // event.currentSlide, event.indexh, event.indexv +} ); +``` + ### Slide change event An 'slidechanged' event is fired each time the slide is changed (regardless of state). The event object holds the index values of the current slide as well as a reference to the previous and current slide HTML nodes. diff --git a/js/reveal.js b/js/reveal.js index c1ffb8f..e53195f 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.1 r33 + * reveal.js 2.1 r34 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -267,6 +267,13 @@ var Reveal = (function(){ // Start auto-sliding if it's enabled cueAutoSlide(); + + // Notify listeners that the presentation is ready + dispatchEvent( 'ready', { + 'indexh': indexh, + 'indexv': indexv, + 'currentSlide': currentSlide + } ); } /** diff --git a/js/reveal.min.js b/js/reveal.min.js index 8f25320..e844a75 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.1 r33 + * reveal.js 2.1 r34 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -18,10 +18,10 @@ f.controlsDown=document.querySelector(".reveal .controls .down");}}function d(){ document.body.style.height="120%";window.addEventListener("load",ad,false);window.addEventListener("orientationchange",ad,false);}}function V(){var al=[],ap=[]; for(var am=0,ak=R.dependencies.length;am<ak;am++){var an=R.dependencies[am];if(!an.condition||an.condition()){if(an.async){ap.push(an.src);}else{al.push(an.src); }if(typeof an.callback==="function"){head.ready(an.src.match(/([\w\d_\-]*)\.?[^\\\/]*$/i)[0],an.callback);}}}function ao(){head.js.apply(null,ap);H();}if(al.length){head.ready(ao); -head.js.apply(null,al);}else{ao();}}function H(){E();K();J();O();}function K(){if(T===false){R.transition="linear";}if(R.controls&&f.controls){f.controls.style.display="block"; -}if(R.progress&&f.progress){f.progress.style.display="block";}if(R.transition!=="default"){f.wrapper.classList.add(R.transition);}if(R.mouseWheel){document.addEventListener("DOMMouseScroll",o,false); -document.addEventListener("mousewheel",o,false);}if(R.rollingLinks){N();}if(R.theme&&f.theme){var am=f.theme.getAttribute("href");var ak=/[^\/]*?(?=\.css)/; -var al=am.match(ak)[0];if(R.theme!==al){am=am.replace(ak,R.theme);f.theme.setAttribute("href",am);}}}function E(){document.addEventListener("touchstart",A,false); +head.js.apply(null,al);}else{ao();}}function H(){E();K();J();O();r("ready",{indexh:m,indexv:e,currentSlide:G});}function K(){if(T===false){R.transition="linear"; +}if(R.controls&&f.controls){f.controls.style.display="block";}if(R.progress&&f.progress){f.progress.style.display="block";}if(R.transition!=="default"){f.wrapper.classList.add(R.transition); +}if(R.mouseWheel){document.addEventListener("DOMMouseScroll",o,false);document.addEventListener("mousewheel",o,false);}if(R.rollingLinks){N();}if(R.theme&&f.theme){var am=f.theme.getAttribute("href"); +var ak=/[^\/]*?(?=\.css)/;var al=am.match(ak)[0];if(R.theme!==al){am=am.replace(ak,R.theme);f.theme.setAttribute("href",am);}}}function E(){document.addEventListener("touchstart",A,false); document.addEventListener("touchmove",af,false);document.addEventListener("touchend",W,false);window.addEventListener("hashchange",w,false);if(R.keyboard){document.addEventListener("keydown",ah,false); }if(R.controls&&f.controls){f.controlsLeft.addEventListener("click",q(B),false);f.controlsRight.addEventListener("click",q(j),false);f.controlsUp.addEventListener("click",q(u),false); f.controlsDown.addEventListener("click",q(F),false);}}function U(){document.removeEventListener("keydown",ah,false);document.removeEventListener("touchstart",A,false); |