several timesをseveral different formsに入れましたが、私の人生のためにはうまく動作しません。JQueryのためのSimplemodal:現在表示されているモーダルを閉じて別のものを表示
私のページには、モーダル、IDサインアップポップアップ、ログインポップアップの2つのDIVがあります。彼らはそれぞれクラスのシンプルモダールクローズのクローズボタンを持っています。
サインアップモーダルにボタンを追加して、それを閉じてログインモードを開きます。私は上記の最初のリンクで説明したEricの指示に従いました。これは以下に含まれています。
$('a#ask').click(function(){
$('#modal-contact').modal({onShow: function (dialog) {
// handle the close yourself.
// Don't use the closeClass on this element
// call $.modal.close(); when you are done
// call a function to open a new modal
});
return false;
});
しかし、これは機能しません。サインアップモーダルは閉じますが、ログインモーダルは閉じません。ここでは(という$よりnoConflictを使用して、jQueryのの、したがって使用()())私のコードは次のとおりです。
jQuery(function (jQuery) {
jQuery('#btn-signup-open').click(function() {
jQuery('#signup-popup').modal({onShow: function (dialog) {
jQuery('#login-from-signup').click(function() {
jQuery.modal.close();
jQuery('#login-popup').modal();
})
}});
return false;
});
});
そして私はまた、それが簡単でより簡単でした考え出す、代わりに次の試してみました、しかし結果はでした同じ(サインアップモーダル閉じ、モーダルが近く、通常の閉じるボタン&フォームは細かい作品を提出していませんログイン):
jQuery(function (jQuery) {
jQuery('#login-from-signup').click(function() {
jQuery.modal.close();
jQuery('#login-popup').modal();
return false;
});
});
私はちょうどモーダルの内容を置き換えることだったエリックの他の提案をしてみてくださいました。これはうまくいくが、hack-yのように思える。クローズボタンを手作業でバインドしなければならないし(大した問題ではない)、小さなロゴフォームではモーダルが自動的にサイズ変更されないからだ。これがうまくいく間に、それを行うためのより良い方法があるように思えます(具体的には、上記のコード、または少し微調整)。
jQuery(function (jQuery) {
jQuery('#login-from-signup').click(function() {
jQuery('.simplemodal-wrap').html('<div class="popup simplemodal-data" id="login-popup" style="display: block;">'+jQuery("#login-popup").html()+'</div>');
jQuery('.simplemodal-close').click(function() {jQuery.modal.close(); return false;});
return false;
});
});
問題を提出していただきありがとうございます。私はできるだけ早くそれを調べます。 –
修正が大好きです。このsetTimeoutの回避策も使用してしまいましたが、明らかに非常にハッキリな状況です。 1.4.1ではsetTimeoutを内部的に使用してダイアログを閉じるので、その周りには方法がありません。 – chug2k