![](/img/trans.png)
[英]Twitter Bootstrap 3 popover not showing from the first click
[英]Twitter Bootstrap popover not working on first click
當我點擊一個錨點時,我正在顯示一個彈出窗口。 但是彈出窗口沒有在第一次點擊時觸發,它在第二次點擊時是如何工作的。
HTML:
<!-- Pop Check -->
<div class="popover-markup">
<input class="checkbox-inline" type="checkbox" value="Option1">
<a href="javascript:void(0)" class="trigger" data-placement="bottom" tooltip="Manage Users">Option1</a>
<!-- Popup Content-->
<div class="content hide">
<div class="head hide">Select Users For Option1<span class="close_popover"><i class="fa fa-times"></i></span></div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="" class="si_DSCM" value="user6"> User 6
</label>
</div>
</div>
</div>
JS:
$(document).on('click', ".popover-markup>.trigger", function () {
$(this).popover({
html: true,
title: function () {
return $(this).parent().find('.head').html();
},
content: function () {
return $(this).parent().find('.content').html();
}
});
});
這是我的小提琴: https : //jsfiddle.net/47pef6g8/
我發現了類似的問題,但在我的案例中並沒有幫助我。
請幫忙。 提前致謝。
查看您的代碼非常清楚您正在初始化點擊上的彈出窗口。 因此,需要兩次單擊才能顯示彈出窗口。 我的建議是在文檔加載時初始化popover。
根據您的問題檢查樣品小提琴 。
$('[data-toggle="popover"]').popover({
html: true,
title: function () {
return $(this).parent().find('.head').html();
},
content: function () {
return $(this).parent().find('.content').html();
}
});
希望這可以幫助。
-救命 :)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.