开发者

Check if one div is hovering another - jQuery/Javascript [duplicate]

This question already has answers here: jQuery/JavaScript collision detection (7 answers) Closed 9 years ago.

Basicly I want to check if one div is hovering another div, I've searched a lot for this, but couldn't find anything D:

I made a div that you can control by using the arrow keys, so now I want to check if that div is hovering another div, if so it should do som开发者_高级运维ething.

I really can't figure this out, please help.


You may take a look at hitTestObject


It seems that you want to detect collision between two elements. So, on some event (keyDown maybe in your case) you have to detect if any of corners of first element (top-left, top-right, bottom-left, bottom-right) is within second element area (somewhere between his corners).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜