Aas*_*han 5 html javascript jquery twitter-bootstrap
当我点击一个锚点时,我正在显示一个弹出窗口.但是弹出窗口没有在第一次点击时触发,它在第二次点击时是如何工作的.
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>
Run Code Online (Sandbox Code Playgroud)
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();
}
});
});
Run Code Online (Sandbox Code Playgroud)
这是我的小提琴: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();
}
});
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助.
-救命 :)
| 归档时间: |
|
| 查看次数: |
2653 次 |
| 最近记录: |