-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Accessing API with multiple embedded presentations #3122
Copy link
Copy link
Closed
Description
In the documentation for API Methods, it says
If you're working with a single presentation instance the API can be accessed via the global
Revealobject.
But what if I'm working with multiple embedded presentations? I've tried a few of different things, none of which work.
On my page, I have a few embedded presentations which I initialize in a for loop. Then I try to detect slidechanged events with .on('slidechanged', ...). This correctly detects slide changes on each presentation, but then console.log(rev.getCurrentSlide()) outputs the current slide of the last presentation on the page (regardless of which presentation had a slidechanged event).
var elms = document.getElementsByClassName( 'reveal' );
for ( var i = 0; i < elms.length; i++ ) {
var rev = new Reveal( elms[ i ], {
// config options
} );
rev.initialize();
rev.on( 'slidechanged', event => {
console.log(rev.getCurrentSlide());
});
}What am I doing wrong?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels