简体   繁体   中英

HTML5 SVG and mouse events

I made a few hexagons with Inkscape and placed them in some HTML5. I got the onmouseover event to work but the onmouseout event does not work. I'm running this on 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

I have changed a few thing in the example to fix it in chrome (the example dosen't work in safari, opera or IE9).

Firstly you had some semi colons after the onmouseover and onmouseout statements.

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:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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