OLD | NEW |
1 <html> | 1 <html> |
2 <title>Title: 0</title> | 2 <title>Title: 0</title> |
3 <style> | 3 <style> |
4 | 4 |
5 .large { | 5 .large { |
6 width: 300px; | 6 width: 300px; |
7 height: 100px; | 7 height: 100px; |
8 background-color: red; | 8 background-color: red; |
9 margin: 300px; | 9 margin: 300px; |
10 } | 10 } |
(...skipping 10 matching lines...) Expand all Loading... |
21 <div name='3' class='large'></div> | 21 <div name='3' class='large'></div> |
22 <div name='4' class='large'></div> | 22 <div name='4' class='large'></div> |
23 <div name='5' class='large'></div> | 23 <div name='5' class='large'></div> |
24 <div name='6' class='large'></div> | 24 <div name='6' class='large'></div> |
25 <div name='7' class='large'></div> | 25 <div name='7' class='large'></div> |
26 <div name='8' class='large'></div> | 26 <div name='8' class='large'></div> |
27 <div name='9' class='large'></div> | 27 <div name='9' class='large'></div> |
28 | 28 |
29 <script> | 29 <script> |
30 | 30 |
| 31 window.touchmoveCount = 0; |
| 32 |
31 function get_current() { | 33 function get_current() { |
32 if (location.hash.length == 0) | 34 if (location.hash.length == 0) |
33 return 0; | 35 return 0; |
34 return parseInt(location.hash.substr(1)); | 36 return parseInt(location.hash.substr(1)); |
35 } | 37 } |
36 | 38 |
37 function navigate_next() { | 39 function navigate_next() { |
38 var current = get_current(); | 40 var current = get_current(); |
39 current = (current + 1) % 10; | 41 current = (current + 1) % 10; |
40 location.hash = "#" + current; | 42 location.hash = "#" + current; |
41 } | 43 } |
42 | 44 |
43 function navigate_prev() { | 45 function navigate_prev() { |
44 var current = get_current(); | 46 var current = get_current(); |
45 current = (current + 9) % 10; | 47 current = (current + 9) % 10; |
46 location.hash = "#" + current; | 48 location.hash = "#" + current; |
47 } | 49 } |
48 | 50 |
49 function touch_start_handler() { | 51 function touch_start_handler() { |
50 } | 52 } |
51 | 53 |
| 54 function touch_move_handler() { |
| 55 window.touchmoveCount++; |
| 56 } |
| 57 |
52 function install_touch_handler() { | 58 function install_touch_handler() { |
53 document.addEventListener('touchstart', touch_start_handler); | 59 document.addEventListener('touchstart', touch_start_handler); |
54 } | 60 } |
55 | 61 |
| 62 function install_touchmove_handler() { |
| 63 document.addEventListener('touchmove', touch_move_handler); |
| 64 } |
| 65 |
| 66 function reset_touchmove_count() { |
| 67 window.touchmoveCount = 0; |
| 68 } |
| 69 |
56 function uninstall_touch_handler() { | 70 function uninstall_touch_handler() { |
57 document.removeEventListener('touchstart', touch_start_handler); | 71 document.removeEventListener('touchstart', touch_start_handler); |
58 } | 72 } |
59 | 73 |
60 function use_replace_state() { | 74 function use_replace_state() { |
61 window.history.replaceState({}, 'foo'); | 75 window.history.replaceState({}, 'foo'); |
62 } | 76 } |
63 | 77 |
64 function use_push_state() { | 78 function use_push_state() { |
65 window.history.pushState({}, 'foo2', 'newpath'); | 79 window.history.pushState({}, 'foo2', 'newpath'); |
66 } | 80 } |
67 | 81 |
68 onload = function() { | 82 onload = function() { |
69 window.onhashchange = function() { | 83 window.onhashchange = function() { |
70 document.title = "Title: " + location.hash; | 84 document.title = "Title: " + location.hash; |
71 } | 85 } |
72 } | 86 } |
73 | 87 |
74 </script> | 88 </script> |
75 | 89 |
76 </html> | 90 </html> |
OLD | NEW |