I am working on an SVG script
have getElementById or getElementsByTagName
but I can not find any method to get elements by position
for example, get elements whose position is x = 10, y = 10.
Is there any way to achieve this?
var yourElement = document.elementFromPoint(10, 10);
Here is a working example that changes the background color of an element at a specified point.
Note that if the specified point is outside the visible area of ββthe document, elementFromPoint will return null .
elementFromPoint
null
You can try the following:
$("svg").find("[x='10'][y='10']");
It will give all elements with svg that have x = 10 and y = 10.
Job demonstration
see this implementation
http://www.webdeveloper.com/forum/archive/index.php/t-50184.html