Skip to main content

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");
info

The deck and section you are currently in can be referred to as {{deck}} and {{section}} respectively.

warning

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.

.getContentPath()

Returns the current "content path", which includes the deck key, section, slide, and subslide (but not page).

const path = Bridge.Navigation.getContentPath();
// e.g. "mydeck/mysection/myslide/subslide-1"

.getServerPath()

Returns the current "server path", typically used for screenshot filenames. Includes deck version, section, slide, subslide, and page.

const path = Bridge.Navigation.getServerPath();

.getPageData()

Returns an object containing pagination data for the currently visible content.

Returns:

Returns { totalPages: number, currentPage: number } or undefined.

const pagination = Bridge.Navigation.getPageData();

.getPaths()

Returns an array of all valid slide paths in the presentation.

const paths = Bridge.Navigation.getPaths();

.getNamespacedKeys()

See .gotoNamespacedKey(namespacedKey), this is useful for querying the available list of namespaced keys. Mostly useful for debugging.

Bridge.Navigation.getNamespacedKeys();

.slideExists(path)

Returns whether a slide exists in the current presentation.

Bridge.Navigation.slideExists("{{deck}}/section_key/slide_key");
info

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);
warning

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/");
note

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.

warning

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.

ParameterTypeDescription
slideKey[/subslideKey]StringTarget slide path
pagesIntegerNumber 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();
});
}
}
});
caution

Requires the deck to use the modern chromium-based screenshotting mechanism

.iterate()

Programmatically steps through every slide, subslide, and page in the presentation. Primarily used for pre-rendering or screenshotting processes.

Bridge.Navigation.iterate();

.clearIterate()

Stops a currently running iteration process.

Bridge.Navigation.clearIterate();

.gotoSlidePage(slide, [subslide, page])

Directly navigates to a specific slide object with optional subslide and page.

Bridge.Navigation.gotoSlidePage(slideModel, "subslide-2", 1);

.getNextSlide()

Calculates and returns the next location in the presentation (slide, subslide, and page).

.getNextSubslide()

Returns the key of the next subslide for the current slide.

.getNextPage(slide, [subslide])

Returns the next page number for the given slide/subslide combination.

.gotoNamespacedKey(namespacedKey)

Go to slide based on the internal namespaced key from the server. This is different to the presenter key as it refers to the internal representation of the key -- this is especially important when dealing with imposter decks, where all slides are in a single section.

Bridge.Navigation.gotoNamespacedKey("sectionName/slideName");