Hold.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  5. <meta http-equiv="x-ua-compatible" content="IE=9">
  6. <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
  7. <link href="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css" rel="stylesheet" />
  8. <link href="css/main.css" type="text/css" rel="stylesheet" />
  9. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  10. <script type="text/javascript" src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
  11. <script type="text/javascript" src="../jquery.touchSwipe.js"></script>
  12. <script type="text/javascript" src="js/main.js"></script>
  13. <!-- use the jquery.ui.ipad.js plugin to translate touch events to mouse events -->
  14. <script type="text/javascript" src="js/jquery.ui.ipad.js"></script>
  15. <title>touchSwipe</title>
  16. </head>
  17. <body>
  18. <a href="https://github.com/mattbryson"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub"></a>
  19. <div class="container">
  20. <script id='code_1'>
  21. $(function() {
  22. //Enable swiping...
  23. $("#test").swipe( {
  24. hold:function(event, target) {
  25. $("#textText").html("You held the tap until the longTapthreshold was reached" );
  26. },
  27. threshold:50
  28. });
  29. });
  30. </script>
  31. <span class='title'></span>
  32. <h4>events: <span class='events'><code>tap</code>, <code>hold</code></span></h4>
  33. <h4>properties: <span class='properties'><code>longTapThreshold</code></span></h4>
  34. <p>You can also detect if the user holds their finger down until the longTapthreshold is met<br/>
  35. The <code>hold</code> handler is passed the original event object and the target that was clicked.
  36. <br/></p>
  37. <p class="muted">If you use the jquery.ui.ipad.js plugin (http://code.google.com/p/jquery-ui-for-ipad-and-iphone/) you can then also pickup
  38. standard jQuery mouse events on children of the touchSwipe object.</p>
  39. <button class='btn btn-small btn-info example_btn'>Jump to Example</button>
  40. <pre class="prettyprint lang-js" data-src='code_1'></pre>
  41. <span class='navigation'></span>
  42. <div id="test" class="box">
  43. <div id="textText">Hold me :)</div><br/>
  44. </div>
  45. <span class='navigation'></span>
  46. </div>
  47. </body>
  48. </html>