0

Web サイトでユーザーがサポートを依頼できるチャット ウィンドウを作成しました。事は、彼が終わってウィンドウを閉じたいと思った後、チャットウィンドウを閉じる「X」を押すことです。しかし、私はここで div を作成しました。これは画面の中央に表示され、ウィンドウを本当に閉じたいかどうかを尋ねます。コードは次のとおりです。

<div id="background">
<div id="stay">
<p style="font-family:Tahoma, Geneva, sans-serif;font-weight:600;font-size:19px;margin-top:10px;">Exiting the support window will delete all the conversation you had with the staff and will disconnect you from the conversation. </p>
<p style="font-family:Tahoma, Geneva, sans-serif;font-weight:600;font-size:19px;">Are you sure you want to exit ?</p>
<div id="agree">
<p>Yes</p>
</div>
<div id="cancel">
<p>No</p>
</div>
</div><!--stay end-->
</div><!--background end-->

Jクエリ:

$("#exit").click(function() {
        $("#livesupport").hide();
        $('html, body').animate({scrollTop:0}, 'fast');
        $("#background").toggle();
        $("body").css({ 'overflow':'hidden' });
        $.post('utility/rchat.php', { table: sessid } , 
        function(getshiton) {
        });
});

「#livesupport」はチャットウィンドウです。

ユーザーがそれを押すとページに戻り、ページに変更が加えられず、はいを押すとサポートウィンドウが閉じられるようにするにはどうすればよいですか。

4

2 に答える 2

1

yes と no で行っていることの代わりに、ポップアップ ボックスを使用します。これは非常に簡単です。コードは次のようになります。

$("#exit").click(function() {
    if(confirm("Are you sure you want to exit this window?")) {
        $("#livesupport").hide();
        $('html, body').animate({scrollTop:0}, 'fast');
        $("#background").toggle();
        $("body").css({ 'overflow':'hidden' });
        $.post('utility/rchat.php', { table: sessid } , 
        function(getshiton) {
        });
    }
});
于 2012-08-22T17:29:21.907 に答える