Rupesh Patel
Rupesh Patel

Reputation: 3075

Find out the text element laid in a path in svg

I have some sort of interactive maps in my app. I have attached mouseover and mouseout handlers for each svg path. now I needed to place text over each svg path to identify the section.

All effect working fine but when user hover the text , which is laid on the path, the mouseover handler doesn't fire.

To cop this issue, I need to find out laid over text for the svg path, So I can attache same handler as the path itself.

This is my resolution towards this problem any other suggestion is also welcomed.

Upvotes: 0

Views: 95

Answers (1)

BigMac66
BigMac66

Reputation: 1538

If I understand you correctly you do not want the text to interfere with mouseover and mouseout handlers. Try adding style="pointer-events:none;" to the text object. Like so:

<text style="pointer-events:none;">Some Text</text>

Upvotes: 1

Related Questions