-
Notifications
You must be signed in to change notification settings - Fork 588
Public Object
Manipulating jQTouch directly with Javascript
jQTouch returns a public object when initialized, which can be assigned to a variable (in this case, the variable name is "jQT"):
<script> var jQT = new $.jQTouch(); </script>
This public variable has several functions which allow you to directly manipulate jQTouch via Javascript. It is recommended you call these function after the document.ready event. These public functions are:
Forces jQTouch to animate to a new page (pageid), with the listed animation.
Example: jQT.goTo('#newpage', 'flip');
Forces jQTouch to go back to a certain page in the history. You can pass a specific page ID, a number of pages (zero-index) to go back, a negative number will go back to the beginning of the history (-n is the first page in history) or nothing to go back one page. If the specified page can not be found, jQTouch will go back one page by default. Example:
jQT.goBack(); // Goes back 1 page in history jQT.goBack(0); // Goes back 1 page in history jQT.goBack(1); // Goes back 2 page in history jQT.goBack(-1); // Goes back to the first page in history jQT.goBack('#home'); // Goes to #home as long as it's in history
Allows the author to dynamically add custom page animations. For more information, see Animations.
Example:
jQT.addAnimation({ name: 'reveal', selector: '.revealme' });