Skip to content Skip to sidebar Skip to footer

How To Get Element By Point In Jquery/javascript

I want to get an element by specifying the point values in page. var point = this.svgRenderer.getPoint(serPoint, chart); This will return exact point location of the page. That po

Solution 1:

Solution 2:

why don't you just use document.elementFromPoint.

the example in the link below shows how it works .

get element by point

Solution 3:

Maybe you can try getIntersectionList from SVG-DOM using a rectangle with a height and width of one as parameter:

Full example:

<?xml version="1.0"?><!DOCTYPE svgPUBLIC"-//W3C//DTD SVG 1.1//EN""http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svgxmlns="http://www.w3.org/2000/svg"version="1.1"width="100"height="100"viewBox="0 0 100 100"onclick="elementsAtEventPosition(event)"><script>functionelementsAtEventPosition(event) {
            var svgRootNode = document.documentElement;
            var rect = svgRootNode.createSVGRect();
            rect.x = event.clientX;
            rect.y = event.clientY;
            rect.width = 1;
            rect.height = 1;
            alert(svgRootNode.getIntersectionList(rect, svgRootNode).length);
        }
    </script><rectx="10"y="10"width="50"height="50"fill="black"stroke="black"stroke-width="1" /></svg>

Post a Comment for "How To Get Element By Point In Jquery/javascript"