在这个SVG(尝试在FF 8,Safari 5.1.2,Chrome 16,全部在Mac上),当鼠标移动到栏上时,没有一个浏览器正确检测每个鼠标上/下事件,有时它工作有时它不会.但它在所有浏览器中都是一致的,所以它可能与SVG代码有关.使用onmouseover并onmouseout给出相同的结果 - 无法正常工作.
在SVG rect角度悬停时实现的正确方法是什么?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="800" height="600" version="1.1" style="display:inline">
<style type="text/css">
.bar {
fill: none;
}
.bar:hover {
fill: red;
}
</style>
<g>
<rect class="bar" x="220" y="80" width="20" height="180" stroke="black" stroke-width="1" />
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)