I have tested the code in Google Chrome. Is there any way to reach purpose?
我在Google Chrome中测试了代码。有没有办法达到目的?
2 个解决方案
#1
22
As @Robert Longson mentioned in the comments, SVG 1.2 was never finalized and SVG 1.2 Tiny is not implemented by web browsers. SVG 2 will have a tabIndex attribute, with the same purpose as in HTML, but there are still some details to work out and many browsers have not implemented it yet (Chrome, IE and Firefox do respect tabIndex on SVG elements in HTML pages).
In the meantime, however, most browsers will allow link elements in SVG to get keyboard focus if they have an xlink:href attribute (even if it is a no-op link like #). You cannot control the tab order, or control focus from scripts, but you can allow users to cycle through elements, and the link will receive user input events.
I was searching for a solution to navigate inside SVG for a while now, my intention is to have some SVG elements and navigate from one to another. A good solution is this library: https://github.com/flesler/jquery.scrollTo/releases My code that navigates from a node to another node is(navigates from yellow circle to red one):