JQuery其他问题淡出效果

时间:2012-06-10 18:18:11

标签: php jquery html fade

$(document).ready(function(){
  setInterval(function(){
    $('.bopa').load('accounts.php');
  },30000);
});
你好!又是我。所以我回到这个东西,我意识到这是JQuery。我可能会在某处放置淡入淡出效果。我只是不知道在哪里。实际上是否有可能,请告诉我在哪里。 php的实际帐户包含类似

的内容
$command=mysql_query("SELECT * FROM pages order by rand()    limit 1");

现在它每3秒钟内容就会改变一次。我首先在文本上尝试它,以便它更容易。后来我打算在照片上做这件事。

1 个答案:

答案 0 :(得分:0)

您可以为正在进行的AJAX请求添加回调函数:

$('.bopa').load('accounts.php');

可以改为:

//start by fading-out the element(s)
$('.bopa').fadeOut(250, function () {
    //continue by loading the new content now that the element(s) has/have faded-out
    $(this).load('accounts.php', function () {

        //now that the new content has loaded, fade the element(s) back in
        $(this).fadeIn(250);
    });
});

这也利用了所使用的jQuery动画函数的回调函数(.fadeIn() / .fadeOut())。