Javascript 如何设置twitter引导弹出窗口的默认属性值?

Javascript 如何设置twitter引导弹出窗口的默认属性值?,javascript,html,twitter-bootstrap,popover,Javascript,Html,Twitter Bootstrap,Popover,如何在twitter引导2和twitter引导3中手动设置默认值 我有下面的代码,您可以在重复使用的选项中看到相同的属性(我必须覆盖它们,因为它们需要与默认值不同) 重复使用的三个属性是triggerplacement&html 如何在javascript中覆盖twitter引导设置的默认选项? Javascript(在DOM就绪时) HTML: <span class="pop1"><i class="icon-info-sign"></i></spa

如何在twitter引导2和twitter引导3中手动设置默认值

我有下面的代码,您可以在重复使用的选项中看到相同的属性(我必须覆盖它们,因为它们需要与默认值不同)

重复使用的三个属性是
trigger
placement
&
html

如何在javascript中覆盖twitter引导设置的默认选项?

Javascript(在DOM就绪时)

HTML:

<span class="pop1"><i class="icon-info-sign"></i></span>
<span class="pop2"><i class="icon-info-sign"></i></span>
<span class="pop3"><i class="icon-info-sign"></i></span>

我想要类似jQuery验证程序(和其他插件)的东西:
jQuery.validator.setDefaults()

因此,基本上,我如何设置twitter bootstrap 2和twitter bootstrap 3的引导默认值?我希望引导使用我的自定义默认值,这样我就不必在整个代码中反复重写它们,如何自定义它,使默认值是我指定的值,而不是Twitter引导2或Twitter引导3。

Bootstrap V2- 您可以记录
默认值
以查看Bootstrap 2设置的所有默认值,方法是:

console.log($.fn.popover.defaults); // Log default values to the console
您可以使用以下方法覆盖Twitter引导2设置的默认值:

// Make sure jQuery is loaded before trying to override the defaults!
$.fn.popover.defaults.trigger = 'hover';   // Set the default trigger to hover
$.fn.popover.defaults.placement = 'right'; // Set the default placement to right
$.fn.popover.defaults.html = true;         // Set the default html (parse html) to true
// Make sure jQuery is loaded before trying to override the defaults!
$.fn.popover.Constructor.DEFAULTS.trigger = 'hover';   // Set the default trigger to hover
$.fn.popover.Constructor.DEFAULTS.placement = 'right'; // Set the default placement to right
$.fn.popover.Constructor.DEFAULTS.html = true;         // Set the default html (parse html) to true


引导V3- 您可以记录
默认值
以查看Bootstrap 3设置的所有默认值,方法是:

console.log($.fn.popover.Constructor.DEFAULTS); // Log default values to the console
您可以使用以下方法覆盖Twitter引导3设置的默认值:

// Make sure jQuery is loaded before trying to override the defaults!
$.fn.popover.defaults.trigger = 'hover';   // Set the default trigger to hover
$.fn.popover.defaults.placement = 'right'; // Set the default placement to right
$.fn.popover.defaults.html = true;         // Set the default html (parse html) to true
// Make sure jQuery is loaded before trying to override the defaults!
$.fn.popover.Constructor.DEFAULTS.trigger = 'hover';   // Set the default trigger to hover
$.fn.popover.Constructor.DEFAULTS.placement = 'right'; // Set the default placement to right
$.fn.popover.Constructor.DEFAULTS.html = true;         // Set the default html (parse html) to true


引导V4- 语法与Bootstrap 3略有不同:

$.fn.popover.Constructor.Default.html = true;

默认值 默认情况下,这些值设置为以下值(它们在Boostrap 2和3中相同):

动画:真
容器:假
内容:“”
延迟:0
html:false
位置:“对”
选择器:false
模板:“”
标题:“
触发器:“悬停”

有关使用AngularJS执行此操作的信息,请参阅:

例如:
$tooltipProvider.options({'placement':'right'})

仅供参考,这似乎不再适用于引导3:(您可以使用引导3使用
$.fn.popover.Constructor.DEFAULTS
,popover的角度实现又如何?引导4的角度实现不同吗?