JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>

CSS

html, body { height; 100%; }

div { height: 2000px;  width: 10px; background: #333;}

.red{ background: red; }

JavaScript

var div = $("div").height();
var doc = $(document).height();
            
if (div > doc ) {
    $("div").addClass('red');
}