touch-firing.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <script src='../../node_modules/jquery/dist/jquery.js'></script>
  6. <script>
  7. $(function() {
  8. $(document)
  9. .on('mousedown', function(ev) {
  10. console.log('mousedown'); //, ev.target);
  11. })
  12. .on('mouseup', function(ev) {
  13. console.log('mouseup'); //, ev.target);
  14. })
  15. .on('mousemove', function(ev) {
  16. console.log('mousemove'); //, ev.target);
  17. })
  18. .on('mouseover', function(ev) {
  19. console.log('mouseover'); //, ev.target);
  20. })
  21. .on('mouseout', function(ev) {
  22. console.log('mouseout'); //, ev.target);
  23. })
  24. .on('click', function(ev) {
  25. console.log('click'); //, ev.target);
  26. })
  27. .on('touchstart', function(ev) {
  28. console.log('touchstart'); //, ev.target);
  29. })
  30. .on('touchend', function(ev) {
  31. console.log('touchend'); //, ev.target);
  32. })
  33. .on('touchmove', function(ev) {
  34. console.log('touchmove'); //, ev.target);
  35. //ev.preventDefault();
  36. });
  37. $('#scroll')
  38. .on('scroll', function(ev) {
  39. console.log('scroll'); //, ev.target);
  40. });
  41. /*
  42. tap:
  43. +touchstart
  44. (delay)
  45. +touchend
  46. (delay)
  47. +mousemove
  48. +mousedown
  49. +mouseup
  50. +click
  51. */
  52. });
  53. </script>
  54. <style>
  55. </style>
  56. </head>
  57. <body>
  58. <div id='scroll' style='width:400px;height:400px;overflow:auto;border:1px solid #000;float:left'>
  59. <div style='width:800px;height:800px'>
  60. test
  61. </div>
  62. </div>
  63. <a href='#' style='float:left;margin-left:1em'>this is a link</a>
  64. </body>
  65. </html>