Returns an node list of elements that are under a rectangle defined by left, top, width, and height.
Syntaxobject.msElementsFromRect(left, top, width, height, retVal)
- left [in]
- top [in]
- width [in]
- height [in]
The following code sample creates a series of overlapping <div> blocks of varying colors. When you click, it uses msElementsFromRec() to get all the elements that are under a 50 pixel rectangular area and changes the background color to gray. Because all elements are returned, including <body> and <html> we only change the background color on the elements with a nodeName of DIV.
var hitTargets = document.msElementsFromRect(e.clientX - 25, e.clientY - 25, 50, 50); // captures elements within 50px block
Build date: 11/16/2013