0
我有一個這樣的頁面,在這裏我有兩個圓形一個黃色和一個紅色,同時放置時,鼠標事件不觸發意味着底層圓形鼠標事件是隱藏鼠標事件不起作用,同時重疊SVG行
<!DOCTYPE html>
<html>
<body>
<h1>My first SVG</h1>
<svg width="100" height="100" style="position:fixed;top:50;left:40;z-index:2;">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" onmouseout="evt.target.setAttribute('opacity','1');" onmouseover="evt.target.setAttribute('opacity','0.5');" onclick="alert('yellow clicked')"/>
Sorry, your browser does not support inline SVG.
</svg>
<svg width="100" height="100" style="position:fixed;top:50;left:40;z-index:1;">
<circle cx="50" cy="50" r="20" stroke="green" stroke-width="4" fill="brown" onmouseout="evt.target.setAttribute('opacity','1');" onmouseover="evt.target.setAttribute('opacity','0.5');" onclick="alert('red clicked')"/>
Sorry, your browser does not support inline SVG.
</svg>
</body>
</html>
謝謝,我現在已經解決了它 – user3516268