jquery - 使用 jquery 在 Hover 中显示路径标题

标签 jquery html css

我想知道如何在悬停时显示 svg 路径标题?

        $( "path" ).click(function() {
            $("#country").val($(this).attr('title'));
            $( "#target" ).submit();
        });

一些 SVG 代码:

<path id="IE-CW" title="Carlow" class="land" d="M458.79,501.13L460.38,501.38L461.8,500.65L463.58,502.11L463.79,502.83L464.9L457.76,504.49L457.53,501.71L458.46,501.86z"/>

最佳答案

Instead of using title attribute, use a nested title element. 
Use the below code:
<path id="IE-CW" title="Carlow" class="land" d="M458.79,501.13L460.38,501.38L461.8,500.65L463.58,502.11L463.79,502.83L464.9L457.76,504.49L457.53,501.71L458.46,501.86z">
 <title>Carlow</title> 
</path>

关于jquery - 使用 jquery 在 Hover 中显示路径标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43673227/

相关文章:

javascript - 事件防止默认不起作用

javascript - 遍历 if,如果为 false 则返回,如果为 true => 停止 if

jquery - 从 Deferreds 数组中提取值

javascript - 如何停止 Canvas 中的动画?

javascript - Bootstrap 3 - 下拉菜单项中的取消按钮

css - 我如何/我可以用类递归缩进 div?

javascript - 单击页面上的任意位置时关闭 div

javascript - 如何防止 CSS 动画在显示属性更改时重新运行?

javascript - 单击后如何随机化图像?

html - 强修饰符将 h1 分成网格