32423hjh32423
32423hjh32423

Reputation: 3088

Capture the swipe effect to navigate to next page in HTML5 Ipad App

I'm making an offline version of an online products catalogue for the Ipad. It will be written in HTML5 / JS and utilise offline image caching and localstorage.

I want to be able to introduce the same UI interactions as come with the Ipad in terms of swiping. So if the user swipes from right to left, it will load the next product. If they swipe from left to right, it will load the previous image.

How do I capture this with Javascript ?

Upvotes: 2

Views: 10189

Answers (1)

mamoo
mamoo

Reputation: 8166

You can have a look at the events supported by mobile Safari here: http://developer.apple.com/library/IOs/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html

touchstart, touchmove and touchend events in particular

Or, if you don't want to reinvent the wheel, you can have a look at these scripts: http://cubiq.org/swipeview

http://plugins.jquery.com/project/swipe

Upvotes: 5

Related Questions