我正在研究 this demo 。我试图发现为什么弹出窗口在通过 .close
按钮关闭后第一次点击时不起作用。
$("#pop-One").popover({
placement: 'right',
html: 'true',
title : '<span class="text-info" style=""><strong>Model Type</strong></span>'+
'<button type="button" class="btn btn-default close" onclick="$("#pop-One").popover("hide");">×</button>',
content : '<p class="popup" style="color:#323232;"> \Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s,</p>'
});
@import 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css';
@import 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css';
body{padding:20px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<div class="container">
<button type="button" class="btn btn-default" id="pop-One" data-toggle="popover"><i class="fa fa-question"></i></button>
</div>
无论出于何种原因,关闭按钮在这里不起作用。我已经看过 this post 但那是一种不同的方法。
最佳答案
不知道这是否是最佳解决方案,但它有效
$("#pop-One").popover({
placement: 'right',
html: 'true',
title : '<span class="text-info" style=""><strong>Model Type</strong></span>'+
'<button type="button" class="btn btn-default close"\
onclick="$("#pop-One").popover("hide");">×</button>',
content : '<p class="popup" style="color:#323232;"> \Lorem Ipsum is simply dummy\ text of the printing and typesetting industry. Lorem Ipsum has been the industry standard\ dummy text ever since the 1500s,</p>'
}).on('shown.bs.popover', function() {
var popup = $(this);
$(this).parent().find("div.popover .close").click(function() {
popup.click();
});
});
here the result of my efforts
关于javascript - 弹出窗口在关闭后第一次点击时不显示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33407069/