Is it possible to use a div as content for Twitter's Popover

后端 未结 8 1359
一向
一向 2020-11-28 01:00

I am using twitter\'s bootstrap\'s popover here. Right now, when i scroll over the popover text a popover appears with just text from the \'s da

8条回答
  •  迷失自我
    2020-11-28 01:38

    Late to the party. Building off the other solutions. I needed a way to pass the target DIV as a variable. Here is what I did.

    HTML for Popover source (added a data attribute data-pop that will hold value for destination DIV id/or class):

    HTML for Popover content (I am using bootstrap hide class):

    Content goes here

    Script:

    $('.popper').popover({
    placement: popover_placement,
    container: 'div.page-content',
    html: true,
    trigger: 'hover',
    content: function () {
        var pop_dest = $(this).attr("data-pop");
        //console.log(plant);
        return $("#"+pop_dest).html();
    }});
    

提交回复
热议问题