document.elementFromPoint – a jQuery solution

While writing a new drag & drop component, i came across the javascript function elementFromPoint(x,y).

The elementFromPoint method returns the DOM node located at the coordinates x,y. This method is truly helpful when it comes to detecting a drop target. You simply get the node at the mouse position with elementFromPoint at the coordinates the drop occured and walk up through the DOM tree untill you find a valid drop target. From a jQuery point of view, this means only using $(nodeUnderPointXY).closest('myDropTargetSelector') on the node.

For more information on this elementFromPoint, see quirksmode’s compatibility table and a demo.

read on further »

posted by nik on November 19, 2010