JSFiddle - React, Tailwind, and code Playground
HTML
<div class="big">
big<br>
big<br>
big<br>
big<br>
big<br>
</div>
CSS
button {
padding: 5px;margin:5px;
}
.big{
width:10000px;
height:10000px;
}
JavaScript
(function () {
var down = false;
var downX;
var downY;
document.onmousedown = function (e) {
downX = e.pageX;
downY = e.pageY;
down = true;
};
document.onmouseup = function () {
down = false;
};
document.onmousemove = function (e) {
if (down) {
window.scrollTo(
window.scrollX + downX - e.pageX,
window.scrollY + downY - e.pageY
);
}
};
})();