小编EnR*_*Lam的帖子

Svg 单击事件无法正常工作

我试图让我的 SVG 看起来像一个“饼形”,这看起来都很好,此外,我希望它们每个都有不同的点击事件。

function one() {
    alert("1");
}
function two() {
    alert("2");
}
function three() {
    alert("3");
}
function four() {
    alert("4");
}
Run Code Online (Sandbox Code Playgroud)
<svg style="position: absolute;height:auto;width:auto;" onClick="one()">
<path d="m 25.857864,25.857865 a 20,20 0 0 1 28.284271,-1e-6 L 40,40 Z"/>
</svg>
<svg style="position: absolute;height:auto;width:auto;" onClick="two()">
<path
   d="m 25.857864,-54.142135 a 20,20 0 0 1 28.284271,-10e-7 L 40,-40 Z" 
   transform="rotate(90)" />
</svg>
<svg style="position: absolute;height:auto;width:auto;" onClick="three()">
<path
   d="m -54.142136,-54.142135 a 20,20 0 0 1 28.284271,-10e-7 L -40,-40 Z" 
   transform="scale(-1)" />
</svg>
<svg style="position: …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery svg

5
推荐指数
1
解决办法
3967
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1

svg ×1