Public Object

Thomas @ BeeDesk edited this page May 25, 2014 · 3 revisions

Manipulating jQTouch directly with Javascript

Public Functions

jQTouch returns a public object when initialized, which can be assigned to a variable (in this case, the variable name is "jQT"):

    var jQT = new $.jQTouch();

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:

goTo( pageid: string, animation: string )

Forces jQTouch to animate to a new page (pageid), with the listed animation.

Example: jQT.goTo('#newpage', 'flip');

goBack( to:object | n )

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

addAnimation( animation:Object )

Allows the author to dynamically add custom page animations. For more information, see Animations.


jQT.addAnimation({ name: 'reveal', selector: '.revealme' });