1 <html> 2 <title>Title: 0</title> 3 <style> 4 5 .large { 6 width: 300px; 7 height: 100px; 8 background-color: red; 9 margin: 300px; 10 } 11 12 ::-webkit-scrollbar { 13 display: none; 14 } 15 16 </style> 17 18 <div name='0' class='large'></div> 19 <div name='1' class='large'></div> 20 <div name='2' class='large'></div> 21 <div name='3' class='large'></div> 22 <div name='4' class='large'></div> 23 <div name='5' class='large'></div> 24 <div name='6' class='large'></div> 25 <div name='7' class='large'></div> 26 <div name='8' class='large'></div> 27 <div name='9' class='large'></div> 28 29 <script> 30 31 window.touchmoveCount = 0; 32 33 function get_current() { 34 if (location.hash.length == 0) 35 return 0; 36 return parseInt(location.hash.substr(1)); 37 } 38 39 function navigate_next() { 40 var current = get_current(); 41 current = (current + 1) % 10; 42 location.hash = "#" + current; 43 } 44 45 function navigate_prev() { 46 var current = get_current(); 47 current = (current + 9) % 10; 48 location.hash = "#" + current; 49 } 50 51 function touch_start_handler() { 52 } 53 54 function touch_move_handler() { 55 window.touchmoveCount++; 56 } 57 58 function install_touch_handler() { 59 document.addEventListener('touchstart', touch_start_handler); 60 } 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 70 function uninstall_touch_handler() { 71 document.removeEventListener('touchstart', touch_start_handler); 72 } 73 74 function use_replace_state() { 75 window.history.replaceState({}, 'foo'); 76 } 77 78 function use_push_state() { 79 window.history.pushState({}, 'foo2', 'newpath'); 80 } 81 82 onload = function() { 83 window.onhashchange = function() { 84 document.title = "Title: " + location.hash; 85 } 86 } 87 88 </script> 89 90 </html> 91