How to check if an element is overlapping other elements? [duplicate]
问题 This question already has answers here : jQuery/JavaScript collision detection (6 answers) Closed 3 years ago . I have two div elements. Each of them have 450px width and height. How do I check if the first div is overlapping the second div? I've tried to use javascript hittest, but it's a little bit complicated. Since I'm trying to find out how it actually work, I would like to get started with a simpler code. I found out that I can use .getClientRects to get the boundary of an element, but