[英]D3-tip behind graph when in modal
This is my first attempt with d3.js and I am having small problem with the d3-tip function. 这是我对d3.js的第一次尝试,我对d3-tip函数的问题很小。 A picture is worth a thousand words so here is my issue.
一张图片胜过千言万语,所以这是我的问题。
d3-tips were working fine until I put my graph inside of a modal. d3-tips工作正常,直到我把我的图形放在一个模态中。 I have tried css z-index as part of the d3-tip style:
我尝试过css z-index作为d3-tip风格的一部分:
.d3-tip {
line-height: 1;
font-weight: bold;
padding: 12px;
background: rgba(0, 0, 0, 0.8);
color: #fff;
border-radius: 2px;
z-index: 1;
}
This didn't have any effect and in my limited css knowledge I think that the z-index is still using my main body as the relational key. 这没有任何影响,在我有限的CSS知识中,我认为z-index仍然使用我的主体作为关系键。
Here is my var tip
setup: 这是我的
var tip
设置:
var tip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.html(function(d) {
return "<strong>Date:</strong> <span style='color:red'>" + d.date + "</span></br><strong>Time:</strong> <span style='color:red'>" + d.time + "</span>
</br><strong>Around:</strong> <span style='color:red'>" + d.timeGroup + "</span>";
});
Here is my modal: 这是我的模态:
<div id="modal-barGraph" class="modal flex-child fade" role='dialog'>
<div class="modal-dialog">
<button class="close white" aria-hidden='' data-dismiss="modal" type="button">X</button>
<div id="barGraph" ></div>
</div>
</div>
I have also tried following the suggestions on this post . 我也尝试过关注这篇文章的建议。
Is there any way to bring the tip to front with my current setup? 有没有办法用我当前的设置将尖端带到前面? Thanks!
谢谢!
Change the current css
z-index
to z-index: 10000
将当前的
css
z-index
更改为z-index: 10000
The modal
has a value greater than 1 (the default is 1050) , therefore you wouldn't see it with the current css
. modal
的值大于1(默认值为1050),因此您不会在当前的css
看到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.