Here is an example for a simple swiping implementation using TouchSwipe.
<!doctype html> <html> <head> <title>Eureka! - TouchSwipe Example</title> <style type="text/css"> #box { background-color: green; width: 400px; height: 225px; line-height: 225px; text-align: center; } </style> </head> <body> <div id="box">Swipe here!</div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.touchSwipe.min.js"></script> <script type="text/javascript"> $("#box").swipe({ swipe: function(event, direction, distance, duration, fingerCount) { $(this).text("You swiped " + direction ); } }); </script> </body> </html>
Done =)
Reference: TouchSwipe: a jQuery plugin for touch and gesture-based interaction
2 thoughts on “jQuery – Implement touch and gesture based interaction using TouchSwipe”