小编BoB*_*B3K的帖子

标题属性不适用于Safari上的SVG Rect

我有一个用d3创建的SVG,它在工具提示弹出窗口的所有rects上都设置了title属性.该代码在Firefox中运行良好,但工具提示不会显示在Safari中 - 无论是Mac还是Windows.我知道title属性正确设置,因为我可以在Safari Web Inspector中看到它.

d3代码剪辑:

.append("rect")
.attr("class", "hmCell")
.attr("x", function(d,i) {
    return cellWidth*i;
})
.attr("y", 0 )          
.attr("width", cellWidth-cellPadding )
.attr("height", cellHeight-cellPadding )    
.style("fill", function(d,i){
        return colorScales[i](d);
})
.attr("title", function(d,i) { return coldata[i]['PrintName']+": "+d; });
Run Code Online (Sandbox Code Playgroud)

Web检查器的片段显示了一些生成的html:

<rect class="hmCell" x="0" y="0" width="34" height="11" style="fill: #9fee49; " title="V1: Derek"></rect>
<rect class="hmCell" x="35" y="0" width="34" height="11" style="fill: #ee99bb; " title="V2: Blue"></rect>
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助

html javascript safari svg d3.js

20
推荐指数
1
解决办法
7437
查看次数

标签 统计

d3.js ×1

html ×1

javascript ×1

safari ×1

svg ×1