add 'ready' event (#182)
This commit is contained in:
parent
f70dcd3c9f
commit
3a2036e2b2
3 changed files with 23 additions and 6 deletions
10
README.md
10
README.md
|
@ -154,6 +154,16 @@ Reveal.addEventListener( 'somestate', function() {
|
||||||
}, false );
|
}, 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
|
### 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.
|
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.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* reveal.js 2.1 r33
|
* reveal.js 2.1 r34
|
||||||
* http://lab.hakim.se/reveal-js
|
* http://lab.hakim.se/reveal-js
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
|
@ -267,6 +267,13 @@ var Reveal = (function(){
|
||||||
|
|
||||||
// Start auto-sliding if it's enabled
|
// Start auto-sliding if it's enabled
|
||||||
cueAutoSlide();
|
cueAutoSlide();
|
||||||
|
|
||||||
|
// Notify listeners that the presentation is ready
|
||||||
|
dispatchEvent( 'ready', {
|
||||||
|
'indexh': indexh,
|
||||||
|
'indexv': indexv,
|
||||||
|
'currentSlide': currentSlide
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
10
js/reveal.min.js
vendored
10
js/reveal.min.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* reveal.js 2.1 r33
|
* reveal.js 2.1 r34
|
||||||
* http://lab.hakim.se/reveal-js
|
* http://lab.hakim.se/reveal-js
|
||||||
* MIT licensed
|
* 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=[];
|
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);
|
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);
|
}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";
|
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.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);
|
}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);
|
||||||
document.addEventListener("mousewheel",o,false);}if(R.rollingLinks){N();}if(R.theme&&f.theme){var am=f.theme.getAttribute("href");var ak=/[^\/]*?(?=\.css)/;
|
}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 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);
|
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);
|
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);
|
}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);
|
f.controlsDown.addEventListener("click",q(F),false);}}function U(){document.removeEventListener("keydown",ah,false);document.removeEventListener("touchstart",A,false);
|
||||||
|
|
Loading…
Reference in a new issue