Javascript touchstart not working at all
<p>I have tried to make a swipe movement in my code and the touchstart is not getting initialized. I tried searching in stackoverflow for a solution, couln't find any. I am a newbie in using js. Here is the link :      </p>

<p><a href="http://codepen.io/avec92/pen/pNbvQw" rel="noreferrer">Sample</a>
<pre><code>window.addEventListener('load', function(){</p>

<pre><code>var box1 = document.querySelector('.nav');
var startx = 0;
var starty = 0;
var dist = 0;
var endx=0;
var endy=0;

box1.addEventListener('touchstart', function(e){
    var touchobj = e.changedTouches[0]; 
    startx = parseInt(touchobj.clientX); 
</code></pre>

<p>starty = parseInt(touchobj.clientY); 
    }, false);</p>

<pre><code>box1.addEventListener('touchmove', function(e){
  e.preventDefault();
    var touchobj = e.changedTouches[0]; 
    endx = parseInt(touchobj.clientX);
    endy = parseInt(touchobj.clientY);
let dist = endy - starty;
   window.scrollBy(0, dist);
}, false);

box1.addEventListener('touchend', function(e){
    var touchobj = e.changedTouches[0]; 
   endx = parseInt(touchobj.clientX);
    endy = parseInt(touchobj.clientY);
}, false);
</code></pre>

<p>}, false);</p>

document.getElementById("btn").addEventListener("click", function(){
document.getElementById("demo").innerHTML = "Hello World";
});
</code></pre>

<p>`
Please help. Also, if there are any alternatives to using touch for implementing swipe, do tell. I cannot use jquery for the same, because I have to replicate it in reactjs. 
Thanks in advance.</p>