Jquery 如何在单击时显示弹出窗口?
我目前使用的是0.5版本的,我正在尝试在发票表的每一行上显示付款按钮的弹出窗口。但我必须点击一下。我有以下JS代码:Jquery 如何在单击时显示弹出窗口?,jquery,html,css,twitter-bootstrap,Jquery,Html,Css,Twitter Bootstrap,我目前使用的是0.5版本的,我正在尝试在发票表的每一行上显示付款按钮的弹出窗口。但我必须点击一下。我有以下JS代码: jQuery(function($){ $('table[data-type="invoices"] a.payments').popover({ live: true, placement: 'left', offset: 5, html: true, content: function() { return $(thi
jQuery(function($){
$('table[data-type="invoices"] a.payments').popover({
live: true,
placement: 'left',
offset: 5,
html: true,
content: function() {
return $(this).attr('class');
},
trigger: 'manual'
}).live('click', function(e){
e.preventDefault();
$(this).popover('show');
});
});
表格HTML如下所示(请参见末尾的链接):
{%trans%}编号{%endtrans%}
{%trans%}客户{%endtrans%}
{%trans%}日期{%endtrans%}
{%trans%}到期日{%endtrans%}
{%trans%}状态{%endtrans%}
{%trans%}到期{%endtrans%}
{%trans%}总计{%endtrans%}
ASET-22
罗克松
5/28/11
9/16/11
{%trans%}过期{%endtrans%}
$11,435.23
如果我移除“手动”触发器,它会工作,但如果我设置它,它不会
有人知道怎么做吗?谢谢 Popover将自动处理您手动执行的某些操作,可能会导致一些奇怪的冲突。您正在不必要地添加自己的单击处理程序,而它本身却可以这样做,并且您正在包装整个设置函数,这似乎是不必要的。试着这样做:
$('table[data-type="invoices"] a.payments').popover({
live: true,
placement: 'left',
offset: 5,
html: true,
content: function() {
return $(this).attr('class');
},
trigger: 'manual'
});
Popover将自动处理您手动执行的某些操作,它可能会导致一些奇怪的冲突。您正在不必要地添加自己的单击处理程序,而它本身却可以这样做,并且您正在包装整个设置函数,这似乎是不必要的。试着这样做:
$('table[data-type="invoices"] a.payments').popover({
live: true,
placement: 'left',
offset: 5,
html: true,
content: function() {
return $(this).attr('class');
},
trigger: 'manual'
});
只是一个更新:Bootstrap 2.1允许您提供
单击
作为触发器。()只是一个更新:Bootstrap 2.1允许您提供单击作为触发器。()