简体   繁体   中英

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.

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>

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