N
N
newaitix2019-02-15 20:10:31
Iron
newaitix, 2019-02-15 20:10:31

Get the element that is in a specific block at the given coordinates?

<div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>

I have cursor coordinates.
How, having only these coordinates, to find out which element the cursor is currently on?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2016-08-19
@Wheelie

This is mini-PCIe (actually M.2 as it turned out later). The ssd will only start if there is support. You need to look at the documentation.
dexp.club/Products/20935/15-6-Noutbuk-DEXP-Atlas-H132 mSata no SSD no M.2 slot no

N
newaitix, 2019-02-15
@newaitix

Everything turned out to be easier. Before doing elementFromPoint I make a draggable element

position:'absolute',
'z-index':-1

then
elementFromPoint
and then my code is setting for draggable element
position:'absolute',
top:(ev.clientY+jsl(config.blankId).animate('scrollTop')-dw.y)+'px',
left:(ev.clientX+jsl('body').animate('scrollLeft')-dw.x)+'px',
width:jsl(dragObject.block).css('offsetWidth')-2+'px',
'z-index':1,
background:'transparent',
border:'1px solid rgba(128,128,128,.5)'

That's how everything works.

M
McBernar, 2019-02-15
@McBernar

What is the problem with taking the coordinates of the upper left corner of the element, calculating the set of points based on this data and the computed dimensions of the element, and checking if the cursor is in this set?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question