JSFiddle - React, Tailwind, and code Playground
by alexcoady
HTML
<div id="footer"></div>
CSS
html, body {
height: 100%;
padding: 0;
margin: 0;
}
#footer {
/* Swap these and run */
height: 200px;
/* height: 2000px; */
}
JavaScript
console.log("Scroll height %s", document.body.scrollHeight);
console.log("Client height %s", document.body.clientHeight);
if (document.body.scrollHeight > document.body.clientHeight) {
console.log("Scroll bigger than client");
var d = document.getElementById("footer").className = "footernoscroll";
} else {
console.log("Scroll NOT bigger than client");
}