gpt4 book ai didi

javascript - Twitter Bootstrap 弹出窗口在第一次点击时不起作用

转载 作者:太空狗 更新时间:2023-10-29 15:48:58 26 4
gpt4 key购买 nike

当我点击一个 anchor 时,我会显示一个弹出窗口。但是弹出窗口不会在第一次点击时触发,如何在第二次点击时触发。

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();
}
});
});

这是我的 fiddle :https://jsfiddle.net/47pef6g8/

我发现了类似的问题,但对我的情况没有帮助。

请帮忙。提前致谢。

最佳答案

查看您的代码,很明显您正在初始化点击时的弹出窗口。因此,需要单击两次才能显示弹出窗口。我对您的建议是在加载文档时初始化弹出窗口。

检查样本Fiddle根据您的问题。

$('[data-toggle="popover"]').popover({
html: true,
title: function () {
return $(this).parent().find('.head').html();
},
content: function () {
return $(this).parent().find('.content').html();
}
});

希望这对您有所帮助。

-帮助:)

关于javascript - Twitter Bootstrap 弹出窗口在第一次点击时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34917037/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com