悬停在SVG多边形上时不显示工具提示 [英] Tooltips not showing when hovering over SVG polygons

查看:113
本文介绍了悬停在SVG多边形上时不显示工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个科罗拉多SVG地图,每个县都有多边形。我希望县名在鼠标悬停时弹出,但这并未发生。我也设置了县改变悬停的方式,而 正在发生。我不确定它们有什么不同。

这些只是标准的浏览器工具提示,每个多边形的 title 属性。



小提琴在这里: http://jsfiddle.net/mmparker/sVbxT/4/

解决方案

对于SVG,您需要使用嵌套< title> 元素而不是标题属性。例如。 < polygon points =...>< title>您的标题< / title>< / polygon>


I have an SVG map of Colorado with polygons for each county. I'd like the county name to pop up on mouse hover, but that isn't happening. I have the counties set to change fill on hover, too, and that is happening. I'm not sure what the difference is.

These are just standard browser tooltips, with the intended text set in each polygon's title attribute.

Fiddle here: http://jsfiddle.net/mmparker/sVbxT/4/

解决方案

For SVG you need to use a nested <title> element rather than a title attribute. E.g. <polygon points="..."><title>your title</title></polygon>

这篇关于悬停在SVG多边形上时不显示工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆