我在 Bootstrap 弹出窗口中遇到一些问题。 jquery 是否加载到 bootstrap popover 中?
这不起作用。
fiddle - http://jsfiddle.net/mVSPR/5/
// make popovers work
$("a[data-toggle=popover]")
.popover()
.click(function (e) {
e.preventDefault()
});
$('.add-action>.trigger').popover({
html: true,
placement: 'bottom',
content: function() {
return $(this).parent().find('.add-review-form').html();
}
});
$('.add-action>.trigger').popover(function (e) {
$('.rate').rateit();
});
我面临的问题是 jquery 星级评定在 bootstrap popover 中不起作用,而在 popover 之外工作得很好。
帮助我。
最佳答案
原因是,你的代码:
content: function() {
return $(this).parent().find('.add-review-form').html();
}
提供 $('.add-review-form') 的副本, Bootstrap 用此副本填充弹出窗口,但事件监听器未复制,因此您需要绑定(bind)复制的 $('.add-review-形式')再次评价它。这是jsfiddle modified :
$('.add-action>.trigger').popover({
html: true,
placement: 'bottom',
content: function () {
return $(this).parent().find('.add-review-form').html();
}
}).click(function () {
$('.rateit-popover').rateit();
});
关于javascript - jquery 星级评定在 bootstrap 弹出窗口中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22854236/