Views
Actions

Event: start

From Turn.js Documentation
(Difference between revisions)
Jump to: navigation, search
 
(16 intermediate revisions by one user not shown)
Line 1: Line 1:
This event is triggered when an animation of a page starts.
+
This event is triggered when an animation of a page starts. In other words, before showing a folded page.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 11: Line 11:
 
| Event Object
 
| Event Object
 
|-
 
|-
| page
+
| pageObject
| Number
+
| Object
| The page number
+
| [[Page Object|The page object]]
 
|-
 
|-
 
| corner
 
| corner
 
| Number
 
| Number
| [[Corner|Corner type]]
+
| [[Corners|Corner type]]
 +
|}
 +
 
 +
{| class="wikitable"
 
|-
 
|-
! scope="col"| Default action
+
! Default action
| colspan="2"| To turn the page
+
|-
 +
| To show the folded page
 
|}
 
|}
  
For example, if you want to only allow the corner at the bottom of the page, you can use the start event and prevent its default action for the [[Corners|corners]] <tt>tl</tt> and <tt>tr</tt>:
+
For example, if you want to prevent the animation to start when using the corners <tt>tl</tt> and <tt>tr</tt>, you can use the start event and prevent its default action:
  
 
<pre class="javascript">
 
<pre class="javascript">
$("#flipbook").bind("start", function(event, page, corner) {
+
$("#flipbook").bind("start", function(event, pageObject, corner) {
if (corner=="tl" || corner=="tr") {
+
  if (corner=="tl" || corner=="tr") {
event.preventDefault();
+
    event.preventDefault();
}
+
  }
 
});
 
});
 
</pre>
 
</pre>
 +
== Event Sequence ==
 +
# [[Event: start| Start]]
 +
# [[Event: turning| Turning]]
 +
# [[Event: turned| Turned]]
 +
# [[Event: end| End]]
 +
 +
 +
== See also ==
 +
[[Corners]]
 
<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 when an animation of a page starts. In other words, before showing a folded page.

Argument Type Description
event Object Event Object
pageObject Object The page object
corner Number Corner type
Default action
To show the folded page

For example, if you want to prevent the animation to start when using the corners tl and tr, you can use the start event and prevent its default action:

$("#flipbook").bind("start", function(event, pageObject, corner) {
  if (corner=="tl" || corner=="tr") {
    event.preventDefault();
  }
});

[edit] Event Sequence

  1. Start
  2. Turning
  3. Turned
  4. End


[edit] See also

Corners

Main Page > API > Turn Events > Event: start