Bootstrap tooltip doesn't show style of the tooltip, only data

前端 未结 11 1673
礼貌的吻别
礼貌的吻别 2021-02-05 06:13

Trying to make Bootstrap show the tooltip function, I have followed exactly as Bootstrap DOC about Tooltips and declare my attribute and properties. when I hover over the text t

相关标签:
11条回答
  • 2021-02-05 07:12

    This question has been sufficiently answered, but the solutions don't apply; my links were in good order. Turns out that there's a conflict with Font Awesome (FA). For example, this wouldn't work for me:

    <span class="fas fa-search" data-toggle="tooltip" title="Search my site"></span>
    

    If I remove the FA classes, and enter text within the span, the tooltips render in the proper style... but isn't a good solution. However, by encapsulating that span within another span does work:

    <span data-toggle="tooltip" title="Search my site"><span class="fas fa-search"></span></span>
    

    I hope this helps the odd soul out there. Or two :^)

    0 讨论(0)
  • 2021-02-05 07:13

    Try adding this code at the bottom of your HTML i've needed it to trigger the tooltip to work. Add class="ttop" to your tooltips in HTML code.

    $(document).ready(function(){
    $(".ttop").tooltip({
        placement : 'top'
    });
    });
    
    0 讨论(0)
  • 2021-02-05 07:14

    In my case using AngularJS, even all css/js scripts were sequenced/invoked properly but still wasn't showing.

    The issue was it's under from a tag with "ng-if" attribute. After I placed it outside from that tag It works fine.

    Maybe there's a slight delay with AngularJS rendering the elements with "ng-if" while jquery is initialising the tooltip.

    0 讨论(0)
  • 2021-02-05 07:15

    make sure if you add bootstrap.min.js and also add

    <script> $(document).ready(function () { $('[data-toggle="tooltip"]').tooltip(); }); </script>
    
    0 讨论(0)
  • 2021-02-05 07:17

    You must initialize tooltip like:

    $('[data-toggle="tooltip"]').tooltip()
    
    0 讨论(0)
提交回复
热议问题