Annabelle Annabelle - 28 days ago 23
Javascript Question

Raphael transparent element onclick

How can I make a fill of the transparent element in Raphael clickable? After specifying fill:"none" for an element (e.g. rect) only a frame is clickable. I need to put fill:"none" in order to make other elements from previous layers visible.

Answer

In SVG you would normally use pointer-events, but Raphael does not support them (as there's no equivalent in VML). The way to accomplish clickable transparent fills in Raphael is to specify a fill with zero transparency with a transparent fill, i.e. fill: "rgba(0,0,0,0) or specify any fill and then fill-transparency: 0.