反正在div标签上使用bootstrap的popover吗?

时间:2015-11-17 16:15:44

标签: javascript twitter-bootstrap popover

Bootstrap的弹出窗口很容易在像demo这样的标签上使用。有没有办法将它用于悬停事件和div标签?

HTML:

<div class="container">
    <a id="popoverData" class="btn" href="#" data-content="Popover with data-trigger" rel="popover" data-placement="bottom" data-original-title="Title" data-trigger="hover">Popover with data-trigger</a>
    <a id="popoverOption" class="btn" href="#" data-content="Popup with option trigger" rel="popover" data-placement="bottom" data-original-title="Title">Popup with option trigger</a>
</div>

JS:

$('#mytext').popover();
$('#name').popover();

1 个答案:

答案 0 :(得分:1)

为什么不呢?

请参阅此jsFiddle:http://jsfiddle.net/9P64a/2892/

<强> HTML

<div id="container" data-content="Popup with option trigger" rel="popover" data-placement="bottom" data-original-title="Title">
    Whatever you want.
</div>

<强>的javascript

$('#container').popover({ trigger: "hover" });