Jquery Touch Swipe Example - Jquery

How to use swipe method in jquery?

Snippet Code


  
Rate this page :
  [ 0 votes]

Touch swipe code is written mainly for ipad. Here, the touch swipe code using jquery allows you to trigger an touch event when user swipes the mouse over p tag content. The simple code for touch swipe using jquery is given below.

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> <script> $(document).on("pagecreate","#currentpage",function(){ $("p").on("swipeleft",function(){ $(this).hide(); }); }); </script> <div data-role="page" id="currentpage"> <div data-role="main" class="ui-content"> <p>Swipe here in the left direction.</p> <p>Swipe me in the left direction!</p> <p>Swipe me in the left direction, too!</p> </div> </div>

Tags


Ask Questions

Ask Question