Main Page: Difference between revisions

From Turn.js Documentation
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
'''MediaWiki has been successfully installed.'''
The first release of turn.js introduced a pretty simple way for adding new pages. In fact, the only thing you had to do was to add as many elements as pages you needed for your book or magazine. Quickly, this scheme brought up a problem in cases where the book contained a large amount of pages.  The solution was to provide a way for creating pages on the fly. Therefore, the 3rd release of turn.js allows you to create pages dynamically.The API is also simple and consistent with the way you are familiar for setting event listeners. This new feature is the foundation in which any kind of e-reader app will be achievable.
 
<pre class="javascript">
function load() {
if (turn.browser.support()) {
$('selector').turn({
elevation: 50,
acceleration: true,
gradients: true,
autoCenter: true,
duration: 1000,
pages: 112,
width:960,
height:600
});
}
}
</pre>
 
If our reader is currently in the page 6, the view for that page will be <tt>6,7</tt>.  From <tt>6-7</tt>, turn.js wants to keep in memory 4 more pages. Therefore, our DOM and JavaScript cache will have the pages <tt>[4, 5, 6, 7, 8, 9]</tt>.  For instance, if our reader is in page 1, the pages to keep in DOM are <tt>[1, 2, 3, 4, 5, 6]</tt>.


Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.
Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.

Revision as of 20:39, 4 July 2012

The first release of turn.js introduced a pretty simple way for adding new pages. In fact, the only thing you had to do was to add as many elements as pages you needed for your book or magazine. Quickly, this scheme brought up a problem in cases where the book contained a large amount of pages. The solution was to provide a way for creating pages on the fly. Therefore, the 3rd release of turn.js allows you to create pages dynamically.The API is also simple and consistent with the way you are familiar for setting event listeners. This new feature is the foundation in which any kind of e-reader app will be achievable.

function load() {
	if (turn.browser.support()) {
	$('selector').turn({
		elevation: 50,
		acceleration: true,
		gradients: true,
		autoCenter: true,
		duration: 1000,
		pages: 112,
		width:960,
		height:600
	});
}
}

If our reader is currently in the page 6, the view for that page will be 6,7. From 6-7, turn.js wants to keep in memory 4 more pages. Therefore, our DOM and JavaScript cache will have the pages [4, 5, 6, 7, 8, 9]. For instance, if our reader is in page 1, the pages to keep in DOM are [1, 2, 3, 4, 5, 6].

Consult the User's Guide for information on using the wiki software.

Getting started