Detect element if over another element via using CSS3 Transform

后端 未结 2 565
我寻月下人不归
我寻月下人不归 2020-12-07 04:14

Any easy way to detect element if its over another element ?

I\'m using CSS3 transform to move a element. (because)

Example : - All element size 10x10 pixels

2条回答
  •  误落风尘
    2020-12-07 05:01

    You can use .offset to see the position of an element relative to the document. This does take into account translate. You can get the coordinates of the rectangle with .offset and then .offset.left + width / .offset.top + height. Then you can easily check for an overlap.

提交回复
热议问题