2014-06-12 86 views

回答

1

請試試這個。

的Html

<a href="#" id="launchModel1">Launch modal 1</a> 

<div id="modal1" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel1" aria-hidden="true"> 
    <div class="modal-dialog modal-lg"> 
    <div class="modal-content"> 
     Modal 1 
    <a href="#" id="launchModel2">Launch modal 2</a> 
    </div> 
    </div> 
</div> 


<div id="modal2" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel2" aria-hidden="true"> 
    <div class="modal-dialog modal-lg"> 
    <div class="modal-content"> 
     Modal 2 
    </div> 
    </div> 
</div> 

的Javascript

$("#launchModel1").bind("click", function(){ 
$('#modal1').modal('show'); 
}); 

$("#launchModel2").bind("click", function(){ 
    $('#modal1').modal('hide'); 
    $('#modal2').modal('show'); 
}); 

工作樣本 - http://www.bootply.com/YR7UREs1Ck

+0

嗨,運作良好,並回答我的問題!我更多地考慮從href獲得的ID,因爲這可以在不使用硬編碼模式2的情況下重用。問題似乎是同時捕獲href和模態細節! – 72GM