SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 85 | Next

Richard Wagner

"Professional iPhone and iPod touch Programming: Building Applications for Mobile Safari"

title)
pageTitle.innerHTML = page.title;
if (page.localName.toLowerCase() == ???form??? & & !page.target)
showForm(page);
var backButton = $(???backButton???);
if (backButton)
{
var prevPage = $(pageHistory[pageHistory.length-2]);
if (prevPage & & !page.getAttribute(???hideBackButton???))
{
backButton.style.display = ???inline???;
backButton.innerHTML = prevPage.title ? prevPage.title : ???Back???;
}
else
backButton.style.display = ???none???;
}
}
The updatePage() function is responsible for updating the pageHistory array, which is required for
enabling the Mobile Safari Back button to work even in single - page applications. The value of the node ??™ s
title attribute is then assigned to be the innerHTML of the top toolbar ??™ s h1 pageTitle .
If the page name contains the string form in it, then the showForm() function is called. Otherwise, the
routine continues on, looking to see if a backButton element is defined in the toolbar. If so, then
the page history is updated and button title is updated.
Subsequent pages will always bypass the direct call to updatePage() and use the slidePages()
function instead. Here is the code:
function slidePages(fromPage, toPage, backwards)
{
var axis = (backwards ? fromPage : toPage).


Pages:
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97