[英]bootstrap popover - custom fields
bootstrap popover allows to change the html template used in the popover. bootstrap popover允许更改在popover中使用的html模板。 i want to modify the original template:
我想修改原始模板:
<div class="popover" role="tooltip">
<div class="arrow"></div>
<h3 class="popover-title"></h3>
<div class="popover-content"></div>
</div>
to something like this: 像这样:
<div class="popover" role="tooltip">
<div class="arrow"></div>
<h3 class="popover-title"></h3>
<div class="popover-content"></div>
<div class="popover-footer"></div>
</div>
in such a way, that i can explicitly pass the footer text in my options in javascript: 以这种方式,我可以在javascript中的选项中显式传递页脚文本:
options = {
title: "my title",
content: "my content",
footer: "my footer"
}
$(".popoverElement").popover(options);
the reason i want to do something like this is that i would like to be able to create a bunch of different popovers with only one part (eg the footer) changing across individual popovers. 我想要执行类似操作的原因是,我希望能够创建一堆不同的Popover,而在单个Popover中只有一个部分(例如,页脚)会发生变化。 but bootstrap doesn't provide such a possibility.
但是引导程序无法提供这种可能性。 do you know a workaround i could use?
您知道我可以使用的解决方法吗?
Yes, it does provide a way of customizing the popover template, with template
option. 是的,它确实提供了一种通过
template
选项来自定义弹出模板的方法。
$(document).ready(function () {
var popoverTemplate = ['<div class="timePickerWrapper popover">',
'<div class="arrow"></div>',
'<div class="popover-content">',
'</div>',
'</div>'].join('');
var content = ['<div class="timePickerCanvas">asfaf asfsadf</div>',
'<div class="timePickerClock timePickerHours">asdf asdfasf</div>',
'<div class="timePickerClock timePickerMinutes"> asfa </div>', ].join('');
$('body').popover({
selector: '[rel=popover]',
trigger: 'click',
content: content,
template: popoverTemplate,
placement: "bottom",
html: true
});
});
Check this https://stackoverflow.com/a/24586543/1151408 检查此https://stackoverflow.com/a/24586543/1151408
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.