Bootstrap Popover:反转标题和内容

时间:2014-08-29 14:31:00

标签: twitter-bootstrap popover

由于我网站上的JS冲突,我无法使用Bootstrap Tooltip。但是Popover工作。所以我尝试使用Popover对Tooltip做一些similir。 我想使用我的HTML元素的“title”标签在Popover内容中使用并将标题定义为默认值。

我的实际代码

<button type="button" class="btn btn-lg btn-danger hasTooltip" title="test de popover" >Click to toggle tooltip</button>
<script type="text/javascript">
    !function ($) {
        $(function(){
            // tooltip demo
            $(".hasTooltip").popover({
                content: function() {
                    return "TITLE";
                },
                title:'Info', 
                trigger: "hover",  
                placement: "bottom"
             });
         })   
    }(window.jQuery)    
</script>

你知道我该怎么做吗?

1 个答案:

答案 0 :(得分:0)

试试这个:

使用'template'您可以随意改变

根据您的要求:

将班级更改为class="popover-title"

$('.hasTooltip').popover({ 'template': '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-title"></div></div>' });

DEMO