2016-10-04 87 views
0

我有一个问题。在我的网站是与选择框自举popover。当我点击popover时,我需要隐藏它。我解决了这个问题,但是当我关闭popop重新加载时,必须双击按钮。这不好。 这是我的代码:隐藏Bootstrap弹出式窗体

<a href="#" id="changeStatusLink" type="button" 
class="pull-right" data-container="body" data-toggle="popover" 
data-placement="bottom" data-original-title="" data-html="true" 
style="margin-right: 0"><span class="glyphicon glyphicon-pencil"></span></a> 

酥料饼的内容:

<div id="changeStatusPopover" class="hide"><form>...</form></div> 

JS:

$('#changeStatusLink').popover({ 
    html: true, 
    content: function() { 
     return $('#changeStatusPopover').html(); 
    } 
}); 

$('body').on('click', function (e) { 
    $('[data-toggle="popover"]').each(function() { 
     if (!$(this).is(e.target) && $(this).has(e.target).length === 0 
      && $('.popover').has(e.target).length === 0) { 
      $(this).popover('hide'); 
     } 
    }); 
}); 

感谢您的帮助

+0

目前尚不清楚。用jsfiddle来检查问题会很好。 – Tushar

+0

在jsfiddle中是正确的:http://jsfiddle.net/z824fn6b/314/。我不知道哪里可以成为问题。 – bluray

+0

我删除了所有的javascript,但这个问题没有解决。 – bluray

回答