jQuery UI Dialogのあるページがあり、そのような Dialog ウィンドウ内のリンクから Fancybox を開きます。
典型的な UI ダイアログの初期化は次のようになります。
$("#dialog-modal").dialog({
height: 240,
modal: true
}); // dialog
... そして典型的な Fancybox (この例では v2.1.1) の初期化は次のようになります:
$(".fancybox").fancybox({
closeClick: false,
helpers: {
title : { type : 'inside' }
}
}); // fancybox
...これまでのところ、特に問題はありません。次にhtml:
<div id="dialog-modal" title="jQuery UI modal dialog">
<p>You should be able to close this UI Dialog using the "escape" key.</p><br />
<a class="fancybox" href="images/01.jpg" title="Press the 'escape' key to close Fancybox" >Open Fancybox</a>
</div>
さて、問題は、「escape
」キーを使用して Fancybox を閉じると、Fancybox と UI ダイアログ (fancybox を起動した場所) の両方が閉じられることです。
キーを使用して Fancybox と UI ダイアログの両方を閉じることができescape
ますが、理想的には Fancybox (キーを使用) を閉じた後も UI ダイアログを開いたままにしたいと思います...たとえば、ボタンでescape
Fancybox を閉じると、UI ダイアログは開いたままになります。close
この問題を説明するために、ここに DEMOを作成しました。
escape
では、Fancyboxを開いたところから UI ダイアログを閉じずに、キーを使用して Fancybox を閉じるにはどうすればよいでしょうか?