$("body").mouseover(function(e) { var element = document.elementFromPoint(e.clientX, e.clientY); var target = $(e.target); if (target.is("div")) { element.style.border = "1px solid blue"; currentElt = target; } element.onmouseout = function() { this.style.border = "0px"; } });
section { overflow: hidden; } div { width: 33.333%; float: left; } .br div { box-sizing: border-box; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <section class="br"> <strong>These divs have border-radius.</strong><br> <div> Some Text, and more text, and more text, and even more text. Some Text, and more text, and more text, and even more text. </div> <div> Some Text, and more text, and more text, and even more text. Some Text, and more text, and more text, and even more text. </div> <div> Some Text, and more text, and more text, and even more text. Some Text, and more text, and more text, and even more text. </div> </section> <section class="nob-r"> <strong>These divs do not have border-radius.</strong><br> <div> Some Text, and more text, and more text, and even more text. Some Text, and more text, and more text, and even more text. </div> <div> Some Text, and more text, and more text, and even more text. Some Text, and more text, and more text, and even more text. </div> <div> Some Text, and more text, and more text, and even more text. Some Text, and more text, and more text, and even more text. </div> </section>