为什么html标题属性和twitter引导数据原始标题相互排斥?

为什么html标题属性和twitter引导数据原始标题相互排斥?,html,twitter-bootstrap,title,popover,Html,Twitter Bootstrap,Title,Popover,我有一个HTMLdiv元素,单击它时会显示一个twitter引导弹出窗口。当前代码如下所示: <div class="popover" title="supplementary info about html element" data-original-title="popover title" data-content="popover content..."> </div> $(document).on('ready', function() { App

我有一个HTMLdiv元素,单击它时会显示一个twitter引导弹出窗口。当前代码如下所示:

<div class="popover" title="supplementary info about html element" 
  data-original-title="popover title" data-content="popover content...">
</div>

$(document).on('ready', function() {
  App.Utils.Popover.enableAll();
});

App.Utils.Popover = {
  enableAll: function() {
    $('.popover').popover(
      {
        trigger: 'click',
        html : true,
        container: 'body',
        placement: 'right'
      }
    );
};

$(文档).on('ready',function(){
App.Utils.Popover.enablell();
});
App.Utils.Popover={
enableAll:function(){
$('.popover').popover(
{
触发器:“单击”,
是的,
容器:'主体',
位置:'对'
}
);
};

问题是twitter引导程序采用title属性值并将其显示为弹出窗口的标题,而不是使用数据原始标题。有没有办法让这两个属性按预期一起工作?

这是因为popover javascript扩展了工具提示javascript,而工具提示javascript(我相信)是用于替换由title属性设置的默认工具提示

这段代码就是罪魁祸首(在bootstrap-tooltip.js中,比如253ish)

其中,如果存在标题属性,则数据原始标题属性将替换为标题属性


编辑基本上我的答案是没有简单的方法。你必须稍微修改引导js,尽管我不建议在这种情况下这样做。可能使用旧版本的引导弹出窗口,其中可能没有该代码?

我也有同样的问题,无法使用不同的引导版本,所以我决定将我的功能注入到popover原型中。不要在家里尝试此功能。

<script src="bower_components/bootstrap-sass/js/bootstrap-popover.js"></script>
<script type="text/javascript">
    // dirty hack
    $.fn.popover.Constructor.prototype.fixTitle = function () {};
</script>

//肮脏的黑客
$.fn.popover.Constructor.prototype.fixtTitle=函数(){};
现在,您可以添加popover的标题和浏览器鼠标悬停的标题:

<i data-placement="bottom" data-trigger="click"
   bs-popover="'views/partials/notifications.html'" data-html="true" 
   data-unique="1" 
   data-original-title="This title will be used by the popover" 
   title="This title will be used by a browser for a mouseover"
/>

我会将此作为一个问题发布到github上。非常感谢!这可能会有所帮助
<i data-placement="bottom" data-trigger="click"
   bs-popover="'views/partials/notifications.html'" data-html="true" 
   data-unique="1" 
   data-original-title="This title will be used by the popover" 
   title="This title will be used by a browser for a mouseover"
/>