Assuming You are doing a drag&drop operation > this is a question with which I have zero personal experience & knowledge.
So I would invite You to do a search for "drag and drop" after which a cornucopia of hits will result.
Examples of two topic hits that offer different approaches:
#1
The Hype Project referenced by this post:D-n-d_test.hype.zip (17.6 KB)
General concept (code snippet here by @h_classen) :
p = element.parentNode;
pX = p.getBoundingClientRect().left;
pY = p.getBoundingClientRect().top;
gX = event['hypeGestureXPosition'];
gY = event['hypeGestureYPosition'];
eW = element.getBoundingClientRect().width;
eH = element.getBoundingClientRect().height;
#2
The following is absolutely marvelous by @rene:
I find this code far more complex than the above "matt5834" posting ~ @h_classen example. From my brief perusal "offset" appears to be the approach for ascertaining the target:
if (vDragHair.offsetLeft > vDropHead.offsetLeft && vDragHair.offsetTop > vDropHead.offsetTop && vDragHair.offsetLeft + vDragHair.offsetWidth < vDropHead.offsetLeft + vDropHead.offsetWidth && vDragHair.offsetTop + vDragHair.offsetHeight < vDropHead.offsetTop + vDropHead.offsetHeight)
**Kokeshi Screen shot**