This following snippet will tell the overlap between elements. This snippet uses the native getBoundingClientRect function of the Element object of DOM. And methods are native and supported in all browsers, it will work or all browsers.
This accepts two parameters, both of Element object type and will return true or false based on their overlap status.
The only constraint with this snippet is that the objects passed have to be native Element objects.
Subscribe to Time to Hack
Get the latest posts delivered right to your inbox