1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90

content / test / data / overscroll_navigation.html [blame]

<html>
<title>Title: 0</title>
<style>

.large {
  width: 300px;
  height: 100px;
  background-color: red;
  margin: 300px;
}

::-webkit-scrollbar {
    display: none;
}

</style>

<div name='0' class='large'>A Large Div</div>
<div name='1' class='large'>A Large Div</div>
<div name='2' class='large'>A Large Div</div>
<div name='3' class='large'>A Large Div</div>
<div name='4' class='large'>A Large Div</div>
<div name='5' class='large'>A Large Div</div>
<div name='6' class='large'>A Large Div</div>
<div name='7' class='large'>A Large Div</div>
<div name='8' class='large'>A Large Div</div>
<div name='9' class='large'>A Large Div</div>

<script>

window.touchmoveCount = 0;

function get_current() {
  if (location.hash.length == 0)
    return 0;
  return parseInt(location.hash.substr(1));
}

function navigate_next() {
  var current = get_current();
  current = (current + 1) % 10;
  location.hash = "#" + current;
}

function navigate_prev() {
  var current = get_current();
  current = (current + 9) % 10;
  location.hash = "#" + current;
}

function touch_start_handler() {
}

function touch_move_handler() {
  window.touchmoveCount++;
}

function install_touch_handler() {
  document.addEventListener('touchstart', touch_start_handler);
}

function install_touchmove_handler() {
  document.addEventListener('touchmove', touch_move_handler);
}

function reset_touchmove_count() {
  window.touchmoveCount = 0;
}

function uninstall_touch_handler() {
  document.removeEventListener('touchstart', touch_start_handler);
}

function use_replace_state() {
  window.history.replaceState({}, 'foo');
}

function use_push_state() {
  window.history.pushState({}, 'foo2', 'newpath');
}

onload = function() {
  window.onhashchange = function() {
    document.title = "Title: " + location.hash;
  }
}

</script>

</html>