JSFiddle - React, Tailwind, and code Playground

HTML

<div id="div1">1</div>
<div id="div2">2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>

CSS

div {
    height:200px;
}
#div1 {
    display:none;
}
#div2 {
    position:absolute;
    top:800px;
}
.highlight {
    background-color:yellow;
}

JavaScript

var first;
$(':visible').not('body, html').each(function() {
    if (typeof first == 'undefined')
        first = $(this);
    if ($(this).offset().top < first.offset().top)
        first = $(this);
});

first.addClass('highlight');