如何顺利替换jgrowl框中的文本?

发布于 2024-10-08 09:22:27 字数 785 浏览 0 评论 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");

它可以工作,但替换后确实很不稳定。

如何在两次加载调用之间平滑过渡?

谢谢阿曼。

I am setting the text inside the jgrowl message box.
Here is the example:

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

It works but the replacement is really jerky.

How to make a smooth transition between two load calls?

Thanks Arman.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

说谎友 2024-10-15 09:22:27

也许在淡出完成后替换 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(); });
        }
);

maybe replace the html after the fadout is complete, then fadeIn again.

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

if you do

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

it'll replace the html the same time it starts fading out.

edit:

couldn't you just write in the findID function? I don't think you need the script tag:

$.ajax( url:'include/common.php?q='+command+'&p='+username, 
        success: function(data){ 
           $(this).fadeOut(function(){ $(this).html(data).fadeIn(); });
        }
);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文