The JavaScript API allows custom functionality to be built into your publications.

We cannot guarantee the stability of any APIs outside of the ones documented below.

Events

/**

* @typedef Config

* @type {Object}

* @property {boolean} scrollTopOnPaging

* @property {boolean} alwaysOpened

* @property {string} defaultPopupBorderColour

* @property {string} defaultPopupButtonBGColour

* @property {string} defaultPopupButtonTextColour

* @property {number} firstPage

* @property {number} jumpToPageOnFirstPageLoad

* @property {number} jumpToPageOnFirstPageLoadDelay

* @property {() => void} onNavigationRendered

* @property {() => void} onPagesViewed

* @property {() => void} onLinkClicked

*/

-----------------------------------------------

ptiOverrideConfig(config) - example

<script>

/**

* @param {Config} config

*/

function ptiOverrideConfig(config) {

config.onNavigationRendered = navigationRendered;

config.onPagesViewed = pagesViewed;

config.onLinkClicked = linkClicked;

}

</script>

-----------------------------------------------

ptiOverrideConfigPostLoad(config) - example

<script type="text/javascript">

/**

* @param {Config} config

*/

function ptiOverrideConfigPostLoad(config) {

config.scrollTopOnPaging = false;

}

</script>

-----------------------------------------------

onNavigationRendered(containerElementID) - example

<script>

/**

* @param {string} containerElementID

*/

function navigationRendered(containerElementID) {

console.log('navigation rendered');

}

/**

* @param {Config} config

*/

function ptiOverrideConfig(config) {

config.onNavigationRendered = navigationRendered;

}

</script>

-----------------------------------------------

onPagesViewed(containerElementID) - example

<script>

/**

* @param {string} containerElementID

* @param {number} leftPageIndex

* @param {number} rightPageIndex

*/

function pagesViewed(containerElementID, leftPageIndex, rightPageIndex) {

// Show the contents popup as soon as the first page is shown

if (leftPageIndex == 0 || rightPageIndex == 0) {

window.ptiContents(containerElementID);

}

}

/**

* @param {Config} config

*/

function ptiOverrideConfig(config){

config.onPagesViewed = pagesViewed;

}

</script>

-----------------------------------------------

onPagesViewed(containerElementID) - example

<script>

/**

* @param {string} containerElementID

* @param {number} type

* @param {number} id

*/

function linkClicked(containerElementID, type, id) {

console.log('link clicked', type, id)

}

/**

* @param {Config} config

*/

function ptiOverrideConfig(config) {

config.onLinkClicked = linkClicked;

}

</script>

Functions

/*

* @param {string} containerElementID

* @param {() => void} callbackFunction

* @returns {void}

*/

ptiClosePopup(containerElementID, callbackFunction)

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @returns {void}

*/

ptiClosePopupGotoPage(containerElementID, pageIndex)

/*

* @param {string} containerElementID

* @param {number} moduleType

* @param {number} moduleID

* @returns {void}

*/

ptiClosePopupLinkClicked(containerElementID, moduleType, id)

/*

* @param {string} containerElementID

* @param {number} moduleType

* @param {number} moduleID

* @param {string} moduleTitle

* @returns {void}

*/

ptiClosePopupLinkClickedUsingTitle(containerElementID, type, pageIndex, moduleTitle)

/*

* @returns {void}

*/

ptiContents()

/*

* @returns {void}

*/

ptiDoublePageView()

/*

* @returns {void}

*/

ptiEnterPageNumber()

/*

* @returns {void}

*/

ptiGetConfig()

/*

* @returns {void}

*/

ptiGetPages()

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @returns {void}

*/

ptiGotoPage(containerElementID, pageIndex)

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @returns {void}

*/

ptiGotoPageIfOnCover(containerElementID, pageIndex)

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @param {number} type

* @param {number} id

* @returns {void}

*/

ptiGotoPageClickLink(containerElementID, pageIndex, type, id)

/*

* @returns {void}

*/

ptiIssues()

/*

* @param {string} containerElementID

* @param {number} type

* @param {number} id

* @returns {void}

*/

ptiLinkClicked(containerElementID, type, id)

/*

* @param {string} containerElementID

* @param {number} type

* @param {number} pageIndex

* @param {string} moduleTitle

* @returns {void}

*/

ptiLinkClickedUsingTitle(containerElementID, type, pageIndex, moduleTitle)

/*

* @returns {void}

*/

ptiNextPage()

/*

* @returns {void}

*/

ptiPauseVideos()

/*

* @returns {void}

*/

ptiPreviousPage()

/*

* @returns {void}

*/

ptiShare()

/*

* @returns {void}

*/

ptiSinglePageView()

/*

* @returns {void}

*/

ptiClosePopup()

/*

* @returns {void}

*/

ptiPauseVideos()

/*

* @returns {void}

*/

ptiSearch()

/*

* @returns {void}

*/

ptiDownloadPDF()

/*

* @returns {void}

*/

ptiShare()

/*

* @returns {void}

*/

ptiPrint()

The JavaScript API allows custom functionality to be built into your publications.

We cannot guarantee the stability of any APIs outside of the ones documented below.

Events

/**

* @typedef Config

* @type {Object}

* @property {boolean} scrollTopOnPaging

* @property {boolean} alwaysOpened

* @property {string} defaultPopupBorderColour

* @property {string} defaultPopupButtonBGColour

* @property {string} defaultPopupButtonTextColour

* @property {number} firstPage

* @property {number} jumpToPageOnFirstPageLoad

* @property {number} jumpToPageOnFirstPageLoadDelay

* @property {() => void} onNavigationRendered

* @property {() => void} onPagesViewed

* @property {() => void} onLinkClicked

*/

-----------------------------------------------

ptiOverrideConfig(config) - example

<script>

/**

* @param {Config} config

*/

function ptiOverrideConfig(config) {

config.onNavigationRendered = navigationRendered;

config.onPagesViewed = pagesViewed;

config.onLinkClicked = linkClicked;

}

</script>

-----------------------------------------------

ptiOverrideConfigPostLoad(config) - example

<script type="text/javascript">

/**

* @param {Config} config

*/

function ptiOverrideConfigPostLoad(config) {

config.scrollTopOnPaging = false;

}

</script>

-----------------------------------------------

onNavigationRendered(containerElementID) - example

<script>

/**

* @param {string} containerElementID

*/

function navigationRendered(containerElementID) {

console.log('navigation rendered');

}

/**

* @param {Config} config

*/

function ptiOverrideConfig(config) {

config.onNavigationRendered = navigationRendered;

}

</script>

-----------------------------------------------

onPagesViewed(containerElementID) - example

<script>

/**

* @param {string} containerElementID

* @param {number} leftPageIndex

* @param {number} rightPageIndex

*/

function pagesViewed(containerElementID, leftPageIndex, rightPageIndex) {

// Show the contents popup as soon as the first page is shown

if (leftPageIndex == 0 || rightPageIndex == 0) {

window.ptiContents(containerElementID);

}

}

/**

* @param {Config} config

*/

function ptiOverrideConfig(config){

config.onPagesViewed = pagesViewed;

}

</script>

-----------------------------------------------

onPagesViewed(containerElementID) - example

<script>

/**

* @param {string} containerElementID

* @param {number} type

* @param {number} id

*/

function linkClicked(containerElementID, type, id) {

console.log('link clicked', type, id)

}

/**

* @param {Config} config

*/

function ptiOverrideConfig(config) {

config.onLinkClicked = linkClicked;

}

</script>

Functions

/*

* @param {string} containerElementID

* @param {() => void} callbackFunction

* @returns {void}

*/

ptiClosePopup(containerElementID, callbackFunction)

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @returns {void}

*/

ptiClosePopupGotoPage(containerElementID, pageIndex)

/*

* @param {string} containerElementID

* @param {number} moduleType

* @param {number} moduleID

* @returns {void}

*/

ptiClosePopupLinkClicked(containerElementID, moduleType, id)

/*

* @param {string} containerElementID

* @param {number} moduleType

* @param {number} moduleID

* @param {string} moduleTitle

* @returns {void}

*/

ptiClosePopupLinkClickedUsingTitle(containerElementID, type, pageIndex, moduleTitle)

/*

* @returns {void}

*/

ptiContents()

/*

* @returns {void}

*/

ptiDoublePageView()

/*

* @returns {void}

*/

ptiEnterPageNumber()

/*

* @returns {void}

*/

ptiGetConfig()

/*

* @returns {void}

*/

ptiGetPages()

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @returns {void}

*/

ptiGotoPage(containerElementID, pageIndex)

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @returns {void}

*/

ptiGotoPageIfOnCover(containerElementID, pageIndex)

/*

* @param {string} containerElementID

* @param {number} pageIndex

* @param {number} type

* @param {number} id

* @returns {void}

*/

ptiGotoPageClickLink(containerElementID, pageIndex, type, id)

/*

* @returns {void}

*/

ptiIssues()

/*

* @param {string} containerElementID

* @param {number} type

* @param {number} id

* @returns {void}

*/

ptiLinkClicked(containerElementID, type, id)

/*

* @param {string} containerElementID

* @param {number} type

* @param {number} pageIndex

* @param {string} moduleTitle

* @returns {void}

*/

ptiLinkClickedUsingTitle(containerElementID, type, pageIndex, moduleTitle)

/*

* @returns {void}

*/

ptiNextPage()

/*

* @returns {void}

*/

ptiPauseVideos()

/*

* @returns {void}

*/

ptiPreviousPage()

/*

* @returns {void}

*/

ptiShare()

/*

* @returns {void}

*/

ptiSinglePageView()

/*

* @returns {void}

*/

ptiClosePopup()

/*

* @returns {void}

*/

ptiPauseVideos()

/*

* @returns {void}

*/

ptiSearch()

/*

* @returns {void}

*/

ptiDownloadPDF()

/*

* @returns {void}

*/

ptiShare()

/*

* @returns {void}

*/

ptiPrint()

Helpful links

Other articles in the ‘Advanced add-ons and APIs’ series

Want to see more?

Settings FAQs

Did this answer your question?