Bootstrap 3 popover and tooltip on the same element

后端 未结 3 1536
自闭症患者
自闭症患者 2021-02-07 16:26

it is possible to use a tooltip and popover of Bootstrap 3 on the same element?

I have a table and want to show on each row (tr) a tooltip. Additionally I want to show

3条回答
  •  别跟我提以往
    2021-02-07 17:30

    You can apply the tooltip to the and the popover to all of the child 's. Define the attributes in javascript and append the attributes to the relevant class (in this example class="my-popover") so that you don't have to write out the popover multiple times.

    For example:

    View:

     
    # First Name Last Name Username
    1 Mark Otto @mdo
    2 Jacob Thornton @fat
    3 Larry the Bird @twitter

    Javascript:

    $( document ).ready(function() {
        $(".my-popover").attr({"data-toggle":"popover", "data-container":"body", "data-placement":"bottom", "data-content":"My popover content", "data-original-title":"Popover title"});
        $("[data-toggle=tooltip]").tooltip();
        $("[data-toggle=popover]").popover();
    });
    

    Bootply here

提交回复
热议问题