Mobile and web developer

How to capture swipe events in mobile devices

In web mobile development we usually need to use swipe events. Many frameworks gives you the posibility of do it but now i'll explain how we can do in a few lines of javascript

Firstly the javascript file: (swipe.js)

We can see in swipe.js swipe left and swipe right events, its really easy capture it. Now is html time.

Only need two divs in our html code,

<div id="swipeRight">Swipe Right</div>
<div id="swipeLeft">Swipe Left</div>
						

Now we have the Events Handler, our two divs in html, and now we need to set when we call this events.

This example is now available at gist.

Fork me at github!!

En github iré subiendo todos mis proyectos y utilidades :)