Pageflip5 API
Pageflip is an extension to the famous jQuery library, currently does not supports the jQuery execution queue
There are two methods added to the jQuery library, they need to be called by selecting the Pageflip container div (div#pageflip):
pageflipInit()
pageflip()
pageflipInit()
It initializes the Pageflip engine, and displays the Book. It have 2 parameters, the Confuguration-Object and an optional alphanumeric ID which is used to create unique URL hash for the book, and added as class to the pageflip DOM parts
pageflip()
It returns the pageflip Context, an object with functions to control the book, this is the pageflip API. Here is the complete list of its functions:
content
is a string containing page definition data with the same format as is was used for content setup.count
number of pages starting from the page specified.Almost all functions are quite simple, and easy to understand, one of them needs more explanation, this is how the setPFEventCallBack
function works.
setPFEventCallBack( EventCallBackObject )
You can pass your own Event CallBack Object to this function, to enable pageflip to call your custom event handler function. This is how an Event CallBack Object looks like:
You can write your own script for each of the event types, to handle your content depending on which of the Book's Pages are actually visible, or flipping etc. So we just defined the Event CallBack Object, now let's assign it to our pageflip: (The example shows it from the initialization of the pageflip)
The reason why is it defined before launching pageflip, is that by setting it after launching we would miss the first Page events.
onFlip
When a flipping starts, both flipped Page recieves this event. The variable PN is the internal page number of the flipping Page.
onFlipEnd
When a Page finished flipping
onTop
When no flipping is in progress, the visible Pages recieves this event. This is the right time to start animations on your Page, or do anything that needed the Page to be visible.
onTopEnd
When the Top status ends.
onLoad
When the Page is added to the DOM. This is where you can initialize your Page if needed, so when it become visible, it will be ready.
onUnload
When the Page is removed from the DOM. This is the last chance to access Page Content from your script.
onHide
When a Page can't be unloaded (with data-unload="false"
Page Option), instead of removing the Page, it is simply hidden, and is still the part of the DOM.
onShow
When a hidden Page become visible again.
onZoomIn
When the Page is magnified. Please note, that the page number is passed to this event handler, but the whole book is zoomed, you can flip to another page, without triggering this event anymore.
onZoomOut
When the Page is zoomed out.