0

問題なく結果のリストを返しました。

そのリスト内のアイテムをクリックすると、クリック可能なアイテムのリストの上にモーダルが表示されます。

モーダルの右上にある閉じるボタンをクリックすると、フェードアウトしてからフェードインします。

リストでクリックを「オフ」にしようとしましたが、オンに戻す方法がありません。

閉じるボタンもリストの上にあるため、そのアクションはモーダルの下にあるリストの「表示」アクションによってすぐに見落とされます。

コードは次のとおりです。

// This does the showing
$('ul.property-content li.box-sizing').on('click',function(){

        $(this).find('.property-modal-wrapper').fadeIn("fast");
        $('ul.property-content li.box-sizing').off('click');// this works

});



// This is inside of the modal element that is inside of the element that does the showing
$('.modal .close').on('click',function(){

        $(this).parentsUntil('li.box-sizing').find('.property-modal-wrapper').fadeOut("fast");
        $('ul.property-content li.box-sizing').on('click');// but can't get this to come back on

});
4

1 に答える 1

0

おそらく .stopPropagation() を使用する必要があり、イベント ハンドラーをオフにしないでください。これを試して:

// This does the showing
$('li').on('click', function() {
    $('#modal').fadeIn("slow");
});

// This is inside of the modal element that is inside of the element that does the showing
$('#modal').on('click', function(event) {
    event.stopPropagation();
    $('#modal').fadeOut("slow");
});​
于 2012-05-03T19:57:18.473 に答える