当你在弹出窗口外单击时,是否可以关闭引导弹出窗口,但当你在弹出窗口内单击时,它会保持打开状态。我知道以前在here中已经讨论过这个问题,但是当你在弹出窗口内单击时,这个也会关闭。
这是他们的演示:http://jsfiddle.net/Sherbrow/e6Gt8/
var $poped = $('.poped');
$poped.popover();
// Trigger for the popover
$poped.each(function() {
var $this = $(this);
$this.on('hover',function() {
var popover = $this.data('popover');
var shown = popover && popover.tip().is(':visible');
if(shown) return; // Avoids flashing
$this.popover('show');
});
});
// Trigger for the hiding
$('html').on('click.popover.data-api',function() {
$poped.popover('hide');
});
发布于 2012-11-05 23:43:59
看一看http://jsfiddle.net/VcwUm/
// Trigger for the hiding
$('html').on('click.popover.data-api',function(e) {
if($(e.target).has('.poped').length == 1){
$poped.popover('hide');
} else {
return false;
}
});我所要做的就是检查目标元素是否有某个类的子元素,以决定是否应该关闭弹出窗口。
https://stackoverflow.com/questions/13235222
复制相似问题