1
0
Fork 0

Firing custom event based on data-state name. This allows developers to trigger custom javascript code on a per slide basis.

This commit is contained in:
Andy Matthews 2012-03-30 06:51:54 -05:00
parent 831236890c
commit 2c78eea0ca
1 changed files with 4 additions and 0 deletions

View File

@ -501,6 +501,10 @@ var Reveal = (function(){
// Apply the new state // Apply the new state
for( var i = 0, len = state.length; i < len; i++ ) { for( var i = 0, len = state.length; i < len; i++ ) {
document.documentElement.classList.add( state[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 // Update progress if enabled