2013-05-01 6 views
0

나는 실행을 시도 할 때 유효성 검사를 위해 팝업을 활성화 할 것이라는 모달을 가지고 있습니다. 3 초 후에 숨기기 위해 팝업 오버 타임을 추가했습니다. 그러나 모달을 닫으면 타임 아웃 기능이 멈춘 것처럼 보이고 팝 오버는 숨기지 않고 직접 숨기기를 말하더라도 작동하지 않습니다.부트 스트랩 모달 팝 오버 닫을 때 숨기기

모달 HTML

모달

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); 

모달 가까운 리스너 내부

<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> 

$("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();

바이올린 이외의 팝 오버 숨길 수있는 깨끗한 방법을 : 2.1.0을 사용하여 http://jsfiddle.net/La2yn/20/

+0

당신이 당신의 HTML을 게시 할 수 모달을 닫는 중지뿐만 아니라 다음 코드

추가를 -.- 모달을 폐쇄했다 .. – PSL

+0

모달에 대한 html을 추가했습니다 – Bankzilla

+0

http://jsfiddle.net/La2yn/을 만들 수 있습니까? 아마도 마크 업을 업데이트하면 모달이 열립니다. – PSL

답변

1

을 모달 닫을 때 팝 오버가 숨어 있지 버그가있다. 2.3.1로 업데이트의 팝 오버는 이제 이벤트가 버블 링뿐만 아니라

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