5 つの jQuery ダイアログ モーダルを使用して、ウィザードのようなエクスペリエンスを作成しようとしています。最初のモーダルから新しいモーダルを起動して、2 番目のモーダルを開きたいのですが、最初のモーダルを閉じます。三代目、四代目、五代目も同様。
他のモーダル内にネストされたモーダルを問題なく開くことができますが、次のモーダルが開いたときに前のモーダルが閉じません。最終的に、5 つのウィンドウが重なり合って開いています。
5つのモーダルのうち2つを開くために使用しているコードは次のとおりです(残りは同じロジックを使用して順番に進みます:
<script>
$(function() {
$( "#modal_1" ).dialog({position:['middle',60],
open: function(event, ui) {
dialogClass: 'ui-widget-shadow',
modal: true,
autoOpen: false,
width: '950px',
close: function(ev, ui) {$(this).close();}
});
$( ".modal_1open" ).click(function() {
$( "#modal_1" ).dialog( "open" );
return false;
});
$( ".btnNext" ).click(function(){
$('.ui-dialog-content').dialog( "close" );
})
});
</script>
<script>
$(function() {
$( "#modal_2" ).dialog({position:['middle',60],
open: function(event, ui) {
dialogClass: 'ui-widget-shadow',
modal: true,
autoOpen: false,
width: '950px',
close: function(ev, ui) {$(this).close();}
});
$( ".modal_2open" ).click(function() {
$( "#modal_2" ).dialog( "open" );
return false;
});
$( ".btnNext" ).click(function(){
$('.ui-dialog-content').dialog( "close" );
})
});
</script>
html の例を次に示します。
<a class="button btnNext">Continue</a> <!--this is the button inside the modal that is supposed to fire the next modal-->
<div style="display:none" id="modal_1" title="Login">
<!--#include file="modal_1.asp"-->
</div>
<div style="display:none;" id="modal_2" title="Page Two Title">
<!--#include file="modal_2.asp"-->
</div>
クローズ機能を次のオープニングにバインドできると思いますが、方法がわかりません。何か助けて??