diff options
author | Andy Matthews <andy@commadelimited.com> | 2012-03-30 06:51:54 -0500 |
---|---|---|
committer | Andy Matthews <andy@commadelimited.com> | 2012-03-30 06:51:54 -0500 |
commit | 2c78eea0ca9496d5eb0e72d92b49aef8b220ef1d (patch) | |
tree | 8de4bce2d05cf2d189ab3b098409eaec076085dd /js | |
parent | 831236890c0d8c4d469cf4eb01b0e7be13de63d5 (diff) | |
download | fosdem-2018-presentation-2c78eea0ca9496d5eb0e72d92b49aef8b220ef1d.tar fosdem-2018-presentation-2c78eea0ca9496d5eb0e72d92b49aef8b220ef1d.tar.gz |
Firing custom event based on data-state name. This allows developers to trigger custom javascript code on a per slide basis.
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js index 1e6ce4d..49c4bc9 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -501,6 +501,10 @@ var Reveal = (function(){ // Apply the new state for( var i = 0, len = state.length; i < len; i++ ) { document.documentElement.classList.add( state[i] ); + // dispatch custom event + var event = document.createEvent("HTMLEvents"); + event.initEvent(state[i], true, true); + document.dispatchEvent(event); } // Update progress if enabled |