JSFiddle - React, Tailwind, and code Playground

by rgthree

HTML

<div class="bar" id="scroll" style="height:1px;"></div>
<div class="bar" id="touchmove" style="height:1px;"></div>

CSS

body {min-height:100000px;}
.bar {width:25%; height:0px; background:#F00; display:inline-block; vertical-align:top;}

JavaScript

var scroll, touchmove;
scroll = document.getElementById('scroll');
touchmove = document.getElementById('touchmove');

window.addEventListener('scroll', function() {
      scroll.style.height = (parseInt(scroll.style.height, 10) + 1) + 'px'; 
})
document.documentElement.addEventListener('touchmove', function() {
      touchmove.style.height = (parseInt(touchmove.style.height, 10) + 1) + 'px'; 
})