Embedded Issuu Reader JavaScript API

The Embedded Issuu Reader can be controlled from within the host web page using JavaScript method calls and events. This document describes the JavaScript programming interface (API). In this API the Embedded Issuu Reader is called the "viewer"

Methods

window.onIssuuReadersLoaded

Callback function, called when a viewer is loaded.

js
window.onIssuuReadersLoaded = function() {
    // viewer is loaded.
}

window.IssuuReaders.get(embedId:string):viewer

Returns the viewer object for a specific embedId.

js
window.IssuuReaders.get("0/1000660");

window.IssuuReaders.add():void

Scans the page and renders the embeds which have not been rendered before.

js
window.IssuuReaders.add();

viewer.getPageNumber():int

Returns the page number of the page currently being viewed.

js
var viewer = window.IssuuReaders.get("0/1000660");
var pageNumber = viewer.getPageNumber();

viewer.setPageNumber(value:int):void

Sets the page number to be viewed. The viewer flips to the specified page and dispatches the change event.

js
var viewer = window.IssuuReaders.get("0/1000660");
viewer.setPageNumber(2);

viewer.getPageCount():int

Returns the total number of pages that can be viewed.

js
var viewer = window.IssuuReaders.get("0/1000660");
var pageCount = viewer.getPageCount();

viewer.goToPreviousPage():void

Asks the viewer to flip to the previous page.

js
var viewer = window.IssuuReaders.get("0/1000660");
viewer.goToPreviousPage();

viewer.goToNextPage():void

Asks the viewer to flip to the next page.

js
var viewer = window.IssuuReaders.get("0/1000660");
viewer.goToNextPage();

viewer.goToFirstPage():void

Asks the viewer to flip to the first page.

js
var viewer = window.IssuuReaders.get("0/1000660");
viewer.goToFirstPage();

viewer.goToLastPage():void

Asks the viewer to flip to the last page.

js
var viewer = window.IssuuReaders.get("0/1000660");
viewer.goToLastPage();

viewer.addEventListener(type:string, listener:function):void

Adds a listener function for a specified event. Currently, the viewer only support "change" event.

js
var viewer = window.IssuuReaders.get("0/1000660");
viewer.addEventListener("change", function() {
    // Dispatched when the page number being viewed has changed.
    // This may happen as a result of user interaction or in response to
    // an API method call like `setPageNumber`, `goToPreviousPage`, etc.
});

For historical reasons we support the value of the listener argument to be the name (string) of the JavaScript function to call in response to the event too.

Example

html
<!-- Your embed code.-->

<div data-configid="0/1000660" style="width: 420px; height: 300px;" class="issuuembed"></div>
<script type="text/javascript" src="//e.issuu.com/embed.js" async="true"></script>


<!-- ISSUU javascript API.-->

<script type="text/javascript" charset="utf-8">
    window.onIssuuReadersLoaded = function() {
        var viewer = window.IssuuReaders.get("0/1000660");

        // Add listener for 'change' event, and flip to page 2.

        viewer.addEventListener("change", function() {
            // viewerChangeHandler
        });
        viewer.setPageNumber(2);
    };
</script>

Limitations