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

后端 未结 8 1328
一向
一向 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:42

    Another alternate method if you wish to just have look and feel of pop over. Following is the method. Offcourse this is a manual thing, but nicely workable :)

    HTML - button

    <button class="btn btn-info btn-small" style="margin-right:5px;" id="bg" data-placement='bottom' rel="tooltip" title="Background Image"><i class="icon-picture icon-white"></i></button>
    

    HTML - popover

    <div class="bgform popover fade bottom in">
                <div class="arrow"></div>
                 ..... your code here .......
    </div>
    

    JS

    $("#bg").click(function(){
            $('.bgform').slideToggle();
    });
    
    0 讨论(0)
  • 2020-11-28 01:46

    Building on jävi's answer, this can be done without IDs or additional button attributes like this:

    http://jsfiddle.net/isherwood/E5Ly5/

    <button class="popper" data-toggle="popover">Pop me</button>
    <div class="popper-content hide">My first popover content goes here.</div>
    
    <button class="popper" data-toggle="popover">Pop me</button>
    <div class="popper-content hide">My second popover content goes here.</div>
    
    <button class="popper" data-toggle="popover">Pop me</button>
    <div class="popper-content hide">My third popover content goes here.</div>
    
    $('.popper').popover({
        container: 'body',
        html: true,
        content: function () {
            return $(this).next('.popper-content').html();
        }
    });
    
    0 讨论(0)
提交回复
热议问题