加载新内容时,bootstrap-popover不会隐藏

时间:2015-08-11 11:53:24

标签: jquery bootstrap-popover

在我的代码中我有一个div我用来加载不同的内容类型使用JQuery,现在我加载到div中的新内容有弹出窗口,问题是当我加载时弹出窗口不会消失新内容进入div,它几​​乎就像被附加到新内容上一样。

将新内容加载到div时,如何让它们消失?

HTML

<div class='box-nfh genericGreyBackground'>
    <div class='box_74'>
        <h2>Performance management is an ongoing process of communication between a supervisor and an employee that occurs throughout the year, in support of accomplishing the strategic objectives of the organisation. It involves five distinct actions. </h2> 
        <div class='pentagonContainer'>
            <div class='pentagon'>
                <img src='images/pentagon.png'>
                <span class='pentagonCircle' id='penBtn1' type='button' data-container='body' data-toggle='popover' data-placement='top' data-content='Clarify expectations'> 1 </span> 
                <span class='pentagonCircle' id='penBtn2' type='button' data-container='body' data-toggle='popover' data-placement='top' data-content='Set objectives'> 2 </span> 
                <span class='pentagonCircle' id='penBtn3' type='button' data-container='body' data-toggle='popover' data-placement='top' data-content='Identify goals'> 3 </span> 
                <span class='pentagonCircle' id='penBtn4' type='button' data-container='body' data-toggle='popover' data-placement='top' data-content='Provide feedback'> 4 </span> 
                <span class='pentagonCircle' id='penBtn5' type='button' data-container='body' data-toggle='popover' data-placement='top' data-content='Evaluate results'> 5 </span> 
            </div>
        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

等待您的答案如何将代码注入&#39; div&#39;这是我的回答。

在注入新内容之前,您可以销毁现有的popovers。这将从UI / DOM中删除它们(并在此过程中释放一些内存)。

$('.pentagonCircle').popover('destroy')

您可能想要更改选择器,可能会将其限制为特定的父级。

文档:http://getbootstrap.com/javascript/#popovers