Firing custom event based on data-state name. This allows developers to trigger custo...
authorAndy Matthews <andy@commadelimited.com>
Fri, 30 Mar 2012 11:51:54 +0000 (06:51 -0500)
committerAndy Matthews <andy@commadelimited.com>
Fri, 30 Mar 2012 11:51:54 +0000 (06:51 -0500)
js/reveal.js

index 1e6ce4d70590018f27f86647f68a1ab4e7576db3..49c4bc9d13ab94215214f205dd5ae9c9af28bfc1 100644 (file)
@@ -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