JSFiddle - React, Tailwind, and code Playground
HTML
<div class="drag" id='red' style='background-color: red;'> </div>
<div class="drag" id='green' style='background-color: green;'> </div>
<div class="drag" id='purple' style='background-color: purple;'> </div>
<div class="drag" id='brown' style='background-color: brown;'> </div>
<div class="drag" id='blue' style='background-color: blue;'> </div>
CSS
.drag { width: 150px; height: 150px; padding: 0.5em; }
JavaScript
jQuery.extend(jQuery.expr[':'], {
overlaps: function(elem, i, m, array) {
console.log( elem, i, m, array.length );
}
});
$("div:overlaps")