我正在使用一个输入组文本框,我需要Bootstrap 3弹出窗口的工作,弹出窗口模板应该是由我设计的定义和n。因此,我目前拥有的html是:
当输入组图标被点击时,我想打开一个弹出窗口。在这种情况下,当单击具有类glyphicon-time的跨度时,弹出窗口将与以下HTML一起显示:
JS写的:
$(document).ready(function () {
var popoverTemplate = ['',
'',
'',
'',
'',
'',
'',
''].join('');
$('body').popover({
selector: '[rel=popover]',
trigger: 'click',
template: popoverTemplate,
placement: "bottom",
html: true
});
});请看这里的小提琴:http://www.bootply.com/4fMzxGRpik
谁能帮我纠正我正在做的错误,以及需要做些什么才能显示一个popvhover。
发布于 2014-07-05 20:41:41
您缺少弹出窗口的内容,您需要这样的内容
$(document).ready(function () {
var popoverTemplate = ['',
'',
'',
'',
''].join('');
var content = ['asfaf asfsadf',
'asdf asdfasf',
' asfa ', ].join('');
$('body').popover({
selector: '[rel=popover]',
trigger: 'click',
content: content,
template: popoverTemplate,
placement: "bottom",
html: true
});
});Working demo
发布于 2019-01-17 11:47:47
我更喜欢在模板中有所有的HTML。它是这样的:
Javascript中的一些东西
$(".btn").popover({
template: $("#selector").html(),
placement: "auto"
});和HTML格式
Anything you want in your popovers, either dynamic or static发布于 2015-06-18 22:19:34
@code-jaff这是一个很好的答案,但我注意到工作演示的弹出窗口看起来不像是从按钮出来的。如果这种情况发生在其他人身上,请尝试将container:'body‘添加到弹出选项中。如下所示:
$('body').popover({
selector: '[rel=popover]',
trigger: 'click',
content: content,
template: popoverTemplate,
placement: "bottom",
html: true,
container: 'body'
});https://stackoverflow.com/questions/24580262
复制相似问题