Documentation
For download and basic HTML setup read the Getting startet page.
On this page you will find a list of all available Options, Methods, Events and CSS Variables.
Options
You can set the options for each vbook either using HTML attributes or in the initialization script.
Set options using the HTML attributes:
<div class="vbook" data-width="19" data-height="26.5"></div>
Set options in the initialization Script:
<script>
const mybook = new Vbook('.vbook',{
width:19,
heihgt:26.5
});
</script>
Note: We recommend using HTML attributes for book specific options such as size or color. Use the initialization script options for global settings and behaviors like uiButtons or uiPagination.
| Option | Description | Type | Default |
|---|---|---|---|
width |
width of the book in millimetres | number | 180 |
|
height of the book in millimetres |
number |
240 |
|
thikness of the book in millimetres |
number |
24 |
|
initial X-rotation in degrees |
number |
0 |
|
initial Y-rotation in degrees |
number |
0 |
|
initial Z-rotation in degrees |
number |
0 |
coverThikness |
Thikness of cover material in millimetres | number | 2 |
|
Color of cover material (front & back) |
color |
#dddddd |
|
Thikness of the spine material in millimetres |
number |
2 |
|
Color of spine materia |
color |
#dddddd |
pages |
Number of pages.0 = user will not be able to open the book. auto = page number will adapt to the number of pages you have added in HTML |
number | 10 |
|
Color of the pages |
color |
#ffffff |
|
Offset of book pages to the cover in millimetres. |
number |
2 |
uiButtons |
0 = hidden left/right navigation arrows 1 = visible buttons |
boolean | false |
|
|
boolean |
false |
|
limits the number of visible dots |
number |
0 |
Methods
After initialization we can control the book with some predefined methods.
Example of vbook initialization and call to the open method:
<script>
const mybook = new Vbook('.vbook');
mybook.open();
</script>
| Method | Description |
|---|---|
init() |
initialize a vbook instance |
|
destroy a vbook insatance. HTML will be removed, events unbind |
|
call the resize function |
|
disable vbook interactions |
|
enable vbook interactions |
|
sets the |
|
removes the active class and removes the keyboard interactions |
|
flip pages to next page |
|
flip pages to prev page |
|
flip pages to page number |
|
flip pages to first page |
|
flip pages to last page |
|
add |
|
remove |
|
open the vbook |
|
close the vbook |
|
rotate the vbook |
Events
Vbook comes with a bunch of useful events you can listen. Events can be assigned in two ways:
1. Using on parameter on vbook initialization
const mybook = new Vbook('.vbook', {
on: {
init: function () {
// do something
}
}
});
2. Using on method after vbook initialization.
const mybook = new Vbook('.vbook');
mybook.on('init', function () {
// do something
});
Here a list of all events
| Event | Description |
|---|---|
init |
Occurs after vbook initialization |
|
Occurs before vbook initialization |
|
Occurs on vbook activation |
|
Occures on vbook deactivation |
|
Occurs on vbook open |
|
Occurs before vbook open |
|
Occurs on vbook close |
|
Occurs before vbook close |
|
Occurs on vbook resize |
|
Occurs on vbook rotation |
|
Occurs on page Flip |
|
Occurs before page Flip |
|
Occurs on page click |
|
Occurs on book click |
|
Occurs on container click |
|
Occurs on navigation button click |
|
Occurs on pagination dot click |