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

Viewer API

window.onIssuuReadersLoaded:function

Callback function, called when a viewer is loaded.

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

Returns the viewer object for a specific embedId.

window.IssuuReaders.add():void

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

viewer.getPageNumber():int

Returns the page number of the page currently being viewed.

viewer.setPageNumber(value:int):void

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

viewer.getPageCount():int

Returns the total number of pages that can be viewed.

viewer.goToPreviousPage():void

Asks the viewer to flip to the previous page.

viewer.goToNextPage():void

Asks the viewer to flip to the next page.

viewer.goToFirstPage():void

Asks the viewer to flip to the first page.

viewer.goToLastPage():void

Asks the viewer to flip to the last page.

Event handling

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

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

Events

change

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.

Example

<!-- 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

  • Local HTML files will not work. The Javascript API will only work on a page accessed via a server.
  • JavaScript API will not work with the iframe version of the embed code to be used with services like Wordpress or Tumblr.
  • The API doesn’t work with mobile devices as of yet. (Don’t worry: no crashes, but no action either. We’re on it!)