0

jgrowl メッセージ ボックス内のテキストを設定しています。次に例を示します。

function findID(whichID, command){
                    if($(whichID).length)
                    {
                        var url='<script>\n\
                         $("'+whichID+'").fadeOut().load("include/common.php?q='+command+'&p='+username+'", function(response, status, xhr) { $(this).fadeIn(); });<\/script>';
                        $(whichID).fadeOut().html(url).fadeIn();
                    }
                }

var myID0="myID0";
var data='<div id="'+myID0+'" class="arm-info"></div>';
            $('#rightcolumn').jGrowl(data, {sticky:true });
mytimerID0=window.setInterval(findID, 3000, '#'+myID0, "show_queue");

それは機能しますが、交換は本当にぎくしゃくしています。

2 つのロード コール間をスムーズに移行するにはどうすればよいですか?

ありがとうアルマン。

4

1 に答える 1

1

フェードアウトが完了したら html を置き換えてから、もう一度フェードインしてください。

$(whichID).fadeOut(function(){ $(this).html(url).fadeIn(); });

もしあなたがそうするなら

$(whichID).fadeOut().html(url).fadeIn();

フェードアウトを開始すると同時に html を置き換えます。

編集:

findID関数に書き込めませんでしたか?script タグは必要ないと思います。

$.ajax( url:'include/common.php?q='+command+'&p='+username, 
        success: function(data){ 
           $(this).fadeOut(function(){ $(this).html(data).fadeIn(); });
        }
);
于 2010-12-20T21:45:26.743 に答える