Bridge.Navigation
.gotoSlide(path)
Go to a presentation's slide by path.
Expects a path string in the format deck/section/slide.
Can also be the next
or prev
keyword.
Bride.Navigation.gotoSlide("{{deck}}/{{section}}/slide_key");
The deck and section you are currently in can be referred to as {{deck}}
and {{section}}
respectively.
When developing for Remote preso, Bridge.Navigation.gotoSlide(path)
should only be triggered on the master - the change of subslide on the
client will be handled by the application / telepresenter code
automatically.
.next(callback)
Go to the next slide, you can pass a callback to be triggered when the next slide is loaded. This is parimarily used for taking snapshots of slides, so it isn't advised that you use this in deck code.
.getSlidePath()
Returns the slide path of the current slide.
.slideExists(path)
Returns whether a slide exists in the current presentation.
Bridge.Navigation.slideExists("{{deck}}/section_key/slide_key");
The deck and section you are currently in can be referred to as {{deck}}
and {{section}}
respectively.
.allowNav(boolean)
Disables/enables app navigation (swiping, keyboard navigation & left/right arrow buttons).
Used for slides that make use of the keyboard, or require user interaction in the left & right areas of the slide.
Bridge.Navigation.allowNav(false);
Must always be set back to true
when no longer required.
.openExternalLink(url)
Opens an external web link as a new tab in the user's default browser.
Bridge.Navigation.openExternalLink("https://developers.livepreso.com/");
When developing for Remote Preso, .openExternalLink(url)
will need
to be triggered from the master and client sides separately as the
result of an explicit user interaction.
Using Bridge.Event
to trigger
Bridge.Navigation.openExternalLink(url)
on the client side will be
blocked by browser security as "Pop-up blocked". eg. a click from
the master triggers a Bridge.Event.on()
listener on the client side
that triggers Bridge.Navigation.openExternalLink(url)
.
.setPages(slideKey[/subslideKey], pages)
Used to tell the screenshotter the number of pages that you expect the content of a slide or subslide to need in PDF format. Needs to be used in combination with the 'showpage' event.
Parameter | Type | Description |
---|---|---|
slideKey[/subslideKey] | String | Target slide path |
pages | Integer | Number of pages to be prepped for screenshotting |
Bridge.Navigation.setPages(slideKey, pages);
Example:
var $slide = Bridge.Slides.getArticle();
var slideKey = Bridge.Slides.getArticleID();
var maxHeight = 400;
$slide.on("sliderendered", function () {
var screenshotMode = $("body").hasClass("screenshot-full");
if (screenshotMode) {
var $scrollDiv = $slide.find("#test-scrolly");
var $scrollContents = $scrollDiv.find("#test-scrolly-contents");
// a rough example of how to calculate the number of pages
var pages = Math.ceil($scrollContents.height() / maxHeight);
if (pages > 1) {
// only invoke the `showpage` mechanism if required
Bridge.Navigation.setPages(slideKey, pages);
Bridge.Event.on(`showpage:${slideKey}`, function (number, done) {
var top = maxHeight * number - maxHeight;
$scrollDiv.scrollTop(top);
done();
});
}
}
});
Requires the deck to use the modern chromium-based screenshotting mechanism