Views
Actions

Event: turning

From Turn.js Documentation
(Difference between revisions)
Jump to: navigation, search
 
(10 intermediate revisions by one user not shown)
Line 15: Line 15:
 
| The page number
 
| The page number
 
|-
 
|-
| [[Views|view]]
+
| view
 
| Array
 
| Array
| The new view
+
| [[Views|The new view]]
 
|}
 
|}
  
Line 26: Line 26:
 
| To turn the page
 
| To turn the page
 
|}
 
|}
 
  
 
For example:
 
For example:
 
<pre class="javascript">
 
<pre class="javascript">
 
$("#flipbook").bind("turning", function(event, page, view) {
 
$("#flipbook").bind("turning", function(event, page, view) {
alert("Turning the page to: "+page);
+
  alert("Turning the page to: "+page);
 
});
 
});
 
</pre>
 
</pre>
 +
 +
You could prevent to turn to the page 1.
 +
<pre class="javascript">
 +
$("#flipbook").bind("turning", function(event, page, view) {
 +
  if (page==1) {
 +
    event.preventDefault();
 +
  }
 +
});
 +
</pre>
 +
 +
 +
== Event Sequence ==
 +
# [[Event: start| Start]]
 +
# [[Event: turning| Turning]]
 +
# [[Event: turned| Turned]]
 +
# [[Event: end| End]]
 
<yambe:breadcrumb>Turn Events</yambe:breadcrumb>
 
<yambe:breadcrumb>Turn Events</yambe:breadcrumb>

Latest revision as of 23:39, 25 November 2012

This event is triggered before turning the page.

Argument Type Description
event Object Event Object
page Number The page number
view Array The new view
Default action
To turn the page

For example:

$("#flipbook").bind("turning", function(event, page, view) {
  alert("Turning the page to: "+page);
});

You could prevent to turn to the page 1.

$("#flipbook").bind("turning", function(event, page, view) {
  if (page==1) {
    event.preventDefault();
  }
});


[edit] Event Sequence

  1. Start
  2. Turning
  3. Turned
  4. End
Main Page > API > Turn Events > Event: turning