Create a single fragment event per fragment-index
authorEric Weikl <eric.weikl@gmx.net>
Tue, 18 Jun 2013 16:33:03 +0000 (18:33 +0200)
committerEric Weikl <eric.weikl@gmx.net>
Tue, 18 Jun 2013 16:33:03 +0000 (18:33 +0200)
For backward-compatibility, add a new 'fragments' property to the
fragmentshown and fragmenthidden events. The 'fragment' property still
returns the first fragment.

js/reveal.js

index 70c782caa16711bdef57f4b6c15a8d7bb6214dc7..074fd9d588ca767e97415a2aa795c2d6854df5eb 100644 (file)
@@ -1916,11 +1916,11 @@ var Reveal = (function(){
 
                                toArray( fragments ).forEach( function( element ) {
                                        element.classList.add( 'visible' );
-
-                                       // Notify subscribers of the change
-                                       dispatchEvent( 'fragmentshown', { fragment: element } );
                                } );
 
+                               // Notify subscribers of the change
+                               dispatchEvent( 'fragmentshown', { fragment: fragments[0], fragments: fragments } );
+
                                updateControls();
                                return true;
                        }
@@ -1950,11 +1950,11 @@ var Reveal = (function(){
 
                                toArray( fragments ).forEach( function( f ) {
                                        f.classList.remove( 'visible' );
-
-                                       // Notify subscribers of the change
-                                       dispatchEvent( 'fragmenthidden', { fragment: f } );
                                } );
 
+                               // Notify subscribers of the change
+                               dispatchEvent( 'fragmenthidden', { fragment: fragments[0], fragments: fragments } );
+
                                updateControls();
                                return true;
                        }