Depends mostly on the framework you're using -- a lot of frameworks have components that support this out-of-the-box.
If you're not using a framework, I'd suggest starting with Hammer.JS (Hammer.JS - Hammer.js) for gesture handling and go from there.
If you're targeting modern iOS (with WKWebView) and/or Firefox, see snap points (http://caniuse.com/#feat=css-snappoints ).
Thanks for your replies. I'm not using any framework. Really, I just want left and right swipe to go from one page to the next or one div to the next. I've pored over the pages on Hammer but can't find how to set this up re. the HTML page markup. I'm new to mobile and am just an amateur with a website. Can you point me to a page with an easy-to-view complete setup model I can copy, paste and adapt?
1 person found this helpful
Using a framework is sound advice.
Suppose something "doesn't work" or suppose the tranisition is too fast/slow/clumsy to your liking, how are you going to find out what to change and how to debug your changes?
Really, if you are new to all this, you should use solutions from a third party. Yes, it requires some work to find out how to implement such framework, but web application development is a bit more complex than building your first Lego limousine.
@MikeBilbo1960: HTML doesn't provide a feature like you're asking natively (short of FireFox/Safari with snap points), and so you'd have to build it up yourself if you're not going to use a framework. That's easier said than done, even for experts, which is why we usually rely on frameworks or other libraries to do it for us.
I just remembered that iscroll has a snapping feature. It's not a huge framework (just takes over scrolling of select containers), and might do what you need. See iScroll 5, smooth scrolling for the web
Thanks. I suppose I thought swiping could be solved by a plugin from Cordova or Npm and built in with Phonegap Build. I see it's not that simple. I'll continue to follow up some of your advice to use some framework.