【发布时间】:2013-07-09 11:44:42
【问题描述】:
如何在twitter bootstrap 2和twitter bootstrap 3中手动设置默认值?
我有以下代码,你可以在选项中看到相同的属性被再次使用(我必须覆盖它们,因为它们需要不同于默认值)。
再次使用的三个属性是triggerplacement和html。
如何覆盖 twitter bootstrap 在我的 javascript 中设置的默认选项?
Javascript (在 DOM 就绪时)
$('.pop1').popover({
trigger: 'hover',
placement : 'right',
html: true, // used once (and the 2 above)
title : 'My title for popover1',
content : 'My content with popover1'
});
$('.pop2').popover({
trigger: 'hover', //used again
placement : 'right',
html: true,
title : 'My title for popover2',
content : 'My content with popover2'
});
$('.pop3').popover({
trigger: 'hover', //and again!
placement : 'right',
html: true,
title : 'My title for popover3',
content : 'My content with popover3'
});
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 Bootstrap 2 或 Twitter Bootstrap 3。
【问题讨论】:
标签: javascript html twitter-bootstrap popover