Tinkering & tailoring
You can customise the behaviour of the plugin with a handful of options, following the format below:
Here’s the complete list of things you can mess about with:
speed number, default: 100
How many milliseconds each page (frame) is visible for.
direction string, default: "forwards"
Accepts either "forwards" or "backwards" and determines which direction the plugin will cycle through the pages.
startFrom number, default: 1
What number page your flip book should start from. If you specify a number larger than the total available pages, it'll revert to the default value (1).
autoplay boolean, default: true
Determines whether your flip book should start animating immediately. If set to "false", you'll need to create a custom control via the 'play' option (detailed later in this section) in order to trigger the animation.
wait boolean, default: true
Determines whether your flip book should wait until images are loaded before starting.
page selector, default: "img"
What element the plugin will recognise as the pages of your flipbook.
inline boolean, default: true
If you don't want the plugin to apply inline CSS to your elements then set this to false. You might just prefer to keep the CSS out of your JS - but it will also mean the CSS is not affected by any unforeseen delays there might be with the loading & initialisation of the plugin. You'll then need to make sure the parent element that contains your pages has position: relative; and for best results also overflow: hidden. Your pages should have position: absolute; display: none. Finally it'd be best to set the width & height of the parent element manually as well, so that it matches the size of your pages/images.
play selector, no default
What element the plugin will recognise as a 'play' button. Clicking on this element will set in motion a non-autoplaying flip book, or resume a paused flip book.
pause selector, no default
What element the plugin will recognise as a 'pause' button. Clicking on this element will pause the flip book on its current page.
rewind selector, no default
What element the plugin will recognise as a 'rewind' button. Clicking on this element will reverse the direction the flip book is playing in.
rewindPlay boolean, default: false
By default, the rewind button will simply reverse the direction the flip book is being instructed to play in. If you do this whilst a flip book is animated, you'll see the effects of this reversal. If you do this whilst a flip book is not animated, you won't see the effects of the reversal until you press 'play' again. However, setting rewindPlay to true will mean the rewind button acts as a sort of 'backwards play' button, both reversing the direction and setting the flip book in motion again if it's not currently animated.