Firefox + Raphael + mouse event = offsetX undefined


Long story short, to get the mouseX position from a raphale’s element inside a mouse event, use this (because offsetX will be undefined…)

var posX = event.offsetX || event.layerX;

that will try to use offsetX or fallback to layerX (which will be defined in Firefox)

Advertisements