Jump to content

How can I navigate/redirect to another page from within a mod


Anton Keller

Recommended Posts

Hi Anton,

An instance of the SpotfireDocument is fetched via the Mod API. Adding this short snippet of script into your mod present on all your pages will turn the analys into a carousel, automatically switching to next page every 3 seconds.

Spotfire.initialize(async (mod) => {

setTimeout(() => moveToNextPage(mod.document), 3000);

});

 

async function moveToNextPage(doc)

{

let activePageIndex = (await doc.activePage()).index;

let pageCount = (await doc.pages()).length;

if (activePageIndex + 1 == pageCount)

{

doc.setActivePage(0);

}

else

{

doc.setActivePage(activePageIndex + 1);

}

}

Regards

Erik

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...