-1

我在 JSFiddle 中对此进行了测试并且运行良好:

身体

<!-- Popover Link -->
<div class="container-fluid">
  <a href="#" rel="popover" data-original-title="">Popover HTML tags</a>
</div>

<!-- Popover DIV content -->
<div id="popover_content_wrapper" style="display: none">
  <div class="row">
    <div class="col-sm-4"><span class="glyphicon glyphicon-user"></span></div>
    <div class="col-sm-8">Username</div>
  </div>
  <div class="row">
    <a href="#" class="btn btn-default">Close</a>
  </div>
</div>

脚本

$(function(){
$('[rel=popover]').popover({ 
    html : true, 
    content: function() {
      return $('#popover_content_wrapper').html();
}
});
});

但在我的网页中是无用的......

JSFiddle 我的测试页面

4

2 回答 2

1

A wild guess : You wonder why the popover not is automatically shown? You need to set the trigger option :

$(function(){
    $('[rel=popover]').popover({ 
        html : true, 
        trigger: 'hover',  //<---here
        content: function() {
          return $('#popover_content_wrapper').html();
        }
    });
});

forked fiddle .> http://jsfiddle.net/q8CV4/

于 2013-10-15T13:29:35.063 回答
0

您可能需要导入引导脚本和 css。

<body></body>.

<body>

    ...

    <link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>

</body>

引导 CDNS

于 2014-01-12T06:24:17.147 回答