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 86 | Next

Richard Wagner

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

getAttribute(???axis???);
if (axis == ???y???)
(backwards ? fromPage : toPage).style.top = ???100%???;
else
toPage.style.left = ???100%???;
toPage.setAttribute(???selected???, ???true???);
scrollTo(0, 1);
clearInterval(checkTimer);
var percent = 100;
Chapter 3: Implementing the Interface
71
slide();
var timer = setInterval(slide, slideInterval);
function slide()
{
percent -= slideSpeed;
if (percent < = 0)
{
percent = 0;
if (!hasClass(toPage, ???dialog???))
fromPage.removeAttribute(???selected???);
clearInterval(timer);
checkTimer = setInterval(checkOrientAndLocation, 300);
setTimeout(updatePage, 0, toPage, fromPage);
}
if (axis == ???y???)
{
backwards
? fromPage.style.top = (100-percent) + ???%???
: toPage.style.top = percent + ???%???;
}
else
{
fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + ???%???;
toPage.style.left = (backwards ? -percent : percent) + ???%???;
}
}
}
The primary purpose of slidePages() is to emulate the standard iPhone/iPod touch slide animation
effect when you move between pages. It achieves this by using JavaScript timer routines to incrementally
update the style.left property of the fromPage and the toPage . The updatePage() function
(discussed previously) is called inside of a setTimeout routine.


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