2013-05-01 132 views
0

我有一個模式,當試圖運行將激活驗證popover。我在3秒後添加了一個超時彈窗來隱藏。但是如果關閉模式,超時功能似乎停止,彈出不會隱藏,甚至直接告訴它隱藏不起作用。Bootstrap模式popover隱藏關閉

HTML模式

<div class="modal hide fade" id ="password_modal"> 
    <div class="modal-header"> 
     <h3>Change Password <span class="extra-title muted"></span></h3> 
    </div> 
    <div class="modal-body form-horizontal"> 
     <div class="control-group"> 
      <label for="current_password" class="control-label">Current Password</label> 
      <div class="controls"> 
       <input type="password" name="current_password"> 
      </div> 
     </div> 
     <div class="control-group"> 
      <label for="new_password" class="control-label">New Password</label> 
      <div class="controls"> 
       <input type="password" name="new_password"> 
      </div> 
     </div> 
     <div class="control-group"> 
      <label for="confirm_password" class="control-label">Confirm Password</label> 
      <div class="controls"> 
       <input type="password" name="confirm_password"> 
      </div> 
     </div>  
    </div> 
    <div class="modal-footer"> 
     <button href="#" class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
     <button href="#" class="btn btn-primary" id="password_modal_save">Save changes</button> 
    </div> 
</div> 

裏面的模式

options = { 
    content: raw_data.errors, 
    html: true, 
    placement: 'top', 
    trigger: 'manual' 
} 
$('#password_modal_save').popover(options); 
$('#password_modal_save').popover('show'); 
setTimeout(function(){ click.popover('hide'); }, 3000); 

模態接近聽衆

$("body").on("hidden", "#password_modal", function(event){ 
    $(this).remove(); //Remove the modal to stop duplications 
    $('#password_modal_save').popover('hide'); //Targetting the popover directly 
    $('.popover').remove(); //Last solution to actually hiding it 
}); 

我霍皮NG藏身比$('.popover').remove();

小提琴以外的酥料餅的清潔方法:http://jsfiddle.net/La2yn/20/

+0

您可以發佈您的html .. – PSL 2013-05-01 00:18:56

+0

已經添加了模態的HTML – Bankzilla 2013-05-01 01:12:40

+0

你可以做一個小提琴http://jsfiddle.net/La2yn/。可能更新你的標記打開模式。 – PSL 2013-05-01 01:26:53

回答

1

使用2.1.0有與模態時關閉沒有隱瞞酥料餅的錯誤。更新2.3.1,該酥料餅是現在關閉模式以及-.-

添加以下代碼,以阻止事件冒泡和關閉模式以及

$("body").on("hidden", "#password_modal_save", function(e){ 
    e.stopPropagation(); //Once popover is hidden stop the event from going to parent 
});