简体   繁体   English

Datatables表标题闪烁时的Bootstrap工具提示

[英]Bootstrap tooltip in Datatables table header flickering

So I'm having some trouble getting a bootstrap tooltip to work inside a datatables object, specifically the header. 因此,在使引导工具提示在datatables对象(特别是标头)中工作时遇到了一些麻烦。 What I believe to be happening is the onhover event of the table header is firing and interfering with bootstraps hover event. 我相信正在发生的是表头的onhover事件正在触发并干扰bootstraps悬停事件。 Now I tried using a high Z-Index but that doesn't seem to help. 现在,我尝试使用较高的Z索引,但这似乎无济于事。 It looks like there is only a few pixels where the actual tooltip is being created, but it often is created and then disappears in the same location 看起来只有几个像素可以创建实际的工具提示,但是通常会创建它,然后消失在同一位置

This is the header that I am working with and any relevant CSS & Javascript code 这是我正在使用的标头以及任何相关的CSS和Javascript代码

{title:"Status <div id=statusHelp class='statusHelp' > </div>" data:obj}

.statusHelp {
background-image: '../img/Circle_ques_icon.svg';
height: 15px;
width: 15px;
z-index: 10000;

} }

<span>Status <div id="statusHelp" class="statusHelp" data-original-title="" title=""> </div></span>

In case anybody ever reads this, I had the same issue and it was solved by setting the container to body: 万一有人读过这个,我也有同样的问题,可以通过将容器设置为body来解决:

            $('body').tooltip({
                selector: '[rel=tooltip]',
                placement: 'auto',
                fallbackPlacement: 'flip',
                container: 'body'
            });

Code to stop the flickering in dataTable works for both headers and body. 停止dataTable中闪烁的代码适用于标头和正文。 I had the problem on both. 我两个都有问题。

$('[data-toggle="tooltip"]').tooltip(
    {
        container: 'body'
    }

);

Just adding the container: 'body' didn't do it for me. 只是添加了container: 'body'对我没有帮助。 I also had to add boundary: 'window' . 我还必须添加boundary: 'window'

$('[data-toggle="tooltip"]').tooltip({
        boundary: "window",
        container: "body"
    });

I have my tooltips set placed on the top and this change prevented them from flipping when only one record was present in the table. 我将工具提示设置在top ,当表中仅存在一条记录时,此更改防止它们翻转。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM