showing results for - "javascript touch scroll event"
Aminata
07 Aug 2017
1var lastTouch = null
2
3window.addEventListener('touchstart', function (event) {
4  lastTouch = event.touches[0]
5})
6
7window.addEventListener('touchend', function (event) {
8  lastTouch = null
9})
10
11window.addEventListener('touchmove', function (event) {
12  var currentTouch = event.changedTouches[0]
13  
14  if (lastTouch) {
15  	target.scrollTop += currentTouch.clientY - lastTouch.clientY
16  }
17  
18  lastTouch = currentTouch
19})
20