123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Zepto touch functional test</title>
- <meta name="viewport" content="maximum-scale=1,initial-scale=1,user-scalable=0">
- <link rel="stylesheet" href="../test.css">
- <script src="../../src/zepto.js"></script>
- <script src="../../src/event.js"></script>
- <script src="../../src/ie.js"></script>
- <script src="../../src/touch.js"></script>
- </head>
- <body>
- <h1>Zepto touch functional test</h1>
- <p>
- Double-tap and hold until the JavaScript alert occurs. After closing the
- alert, tap again. Without touchcancel you will see a double tap instead of a tap.
- </p>
- <div id="touch_test" style="width: 200px; height: 200px; background: #ddd">
- touch events test
- </div>
- <div id="browser"> </div>
- <script>
- $('#browser').text(navigator.userAgent)
- setTimeout(function(){
- alert("Alert! Now tap again, you should see a tap!, not a double tap!")
- }, 3000)
- $('body').bind('touchmove', function(e){ e.preventDefault() })
- $('#touch_test')
- .tap(function(){
- $(this).append(' | tap!')
- })
- .doubleTap(function(){
- $(this).append(' | double tap!')
- })
- .swipe(function(){
- $(this).append(' | swipe!')
- })
- .swipeLeft(function(){
- $(this).append(' | swipe left!')
- })
- .swipeRight(function(){
- $(this).append(' | swipe right!')
- })
- .swipeUp(function(){
- $(this).append(' | swipe up!')
- })
- .swipeDown(function(){
- $(this).append(' | swipe down!')
- })
- </script>
- </body>
- </html>
|