简体   繁体   English

HTML5 SVG 和鼠标事件

[英]HTML5 SVG and mouse events

I made a few hexagons with Inkscape and placed them in some HTML5.我用 Inkscape 制作了几个六边形,并将它们放在一些 HTML5 中。 I got the onmouseover event to work but the onmouseout event does not work.我让 onmouseover 事件起作用,但 onmouseout 事件不起作用。 I'm running this on Google Chrome 11.0.696.57 beta.我在 Google Chrome 11.0.696.57 beta 上运行它。 Does anyone know what the problem is?有谁知道问题是什么?

Here is link to HTML https://docs.google.com/leaf?id=0B7ZCkMUvddWIOTAxNmJlYjctODNlOS00MzFlLTgwY2EtOTY1NzZkZGQ2Yjgx&sort=name&layout=list&num=50这是指向 HTML https://docs.google.com/leaf?id=0B7ZCkMUvddWIOTAxNmJlYjctODNlOS00MzFlLTgwY2EtOTY1NzZk&&layout=&num=g=g的链接

I have changed a few thing in the example to fix it in chrome (the example dosen't work in safari, opera or IE9).我在示例中更改了一些内容以在 chrome 中修复它(示例在 safari、opera 或 IE9 中不起作用)。

Firstly you had some semi colons after the onmouseover and onmouseout statements.首先,在 onmouseover 和 onmouseout 语句之后有一些分号。

onmouseover = "Hilight(evt)"
onmouseout = "Darken(evt)"

Secondly the event was firing but the alpha was 0.06 I changed it to 0.6 and now it is much more obvious that it is firing:其次,事件正在触发,但 alpha 为 0.06,我将其更改为 0.6,现在更明显的是它正在触发:

function Darken(evt) {
     var GameSpace = evt.target;
     GameSpace.setAttribute("style", "fill-opacity: 0.6"); 
}

http://jsfiddle.net/ERyS4/7/ http://jsfiddle.net/ERyS4/7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM