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");

它有效,但替换真的很生涩。

如何在两个负载调用之间进行平滑过渡?

谢谢阿曼。

4

1 回答 1

1

可能在淡出完成后替换html,然后再次淡入。

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

如果你这样做

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

它将在开始淡出的同时替换 html。

编辑:

你不能只写在 findID 函数中吗?我认为您不需要脚本标签:

$.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 回答