Method: range: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 28: | Line 28: | ||
The last example will add the pages that are closest to the page 10. | The last example will add the pages that are closest to the page 10. | ||
Assuming that display is double, those pages are <tt>[8, 9, '''10''', 11, 12, 13]</tt>. | Assuming that display is <tt>double</tt>, those pages are <tt>[8, 9, '''10''', 11, 12, 13]</tt>. | ||
<yambe:breadcrumb>Turn Methods</yambe:breadcrumb> | <yambe:breadcrumb>Turn Methods</yambe:breadcrumb> |
Revision as of 16:53, 6 July 2012
Returns an array of two values where the first element refers to a page number from which next pages should be contained in the DOM tree. The second element refers to the last page number of the range. That is, the current range always has the following relationship: range[0] <= $("#flipbook").turn("page") <= range[1]
Parameter | Type | Description | Default Value |
---|---|---|---|
pageNumber | Number | A page number within a range | $("#flipbook").turn("page") |
For example, in order to add new pages dynamically, you could use use the range method:
var range = $("#flipbook").turn("range", 10); for (var page = range[0]; page<=range[1]; page++){ if (!$("#flipbook").turn("hasPage", page)) { $("#flipbook").turn("addPage", $("<div />"), page); } }
The last example will add the pages that are closest to the page 10.
Assuming that display is double, those pages are [8, 9, 10, 11, 12, 13].
<yambe:breadcrumb>Turn Methods</yambe:breadcrumb>