Skip to content
Advertisement

Firefox div > svg mouseover fires OUTSIDE div

I have a div with two svg-elements inside, which are shown/hidden when hovering with the mouse. The mouseover event is registered with the div.

On Chrome and Safari it works, on FF the SVG sits at a different position and the “hitbox” of the div where I can hover, is very large, like 3 times the actual size of the div (checked with Firebug, the div also has width and height set to pixels).

How can it be that the mouseover-event fires at a larger region than the div occupies?

JavaScript
JavaScript
JavaScript

LINK: http://streuplan.feibra.at/streuplan/index.php?r=streuplan/go

Advertisement

Answer

Your <svg> elements don’t have width and height attributes. This means they become 300 x 150 pixels in size (Chrome doesn’t implement this correctly which is why you see the difference). I’m not sure what you want in your case but starting with a width and height of 100% would not be ureasonable.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement