0
$(document).ready(function(){
  setInterval(function(){
    $('.bopa').load('accounts.php');
  },30000);
});

嗨,大家好!又是我。所以我回到这些东西上,我意识到这是 JQuery。也许我可以在那里的某个地方放置一个淡入淡出效果。我只是不知道在哪里。如果可以的话,真的有可能吗,请告诉我在哪里。帐户 php 实际上包含类似

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

现在它每 3 秒工作一次,内容会发生变化。我先在文本上尝试它,这样会更容易。以后我打算在图片上做。

4

1 回答 1

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())。

于 2012-06-10T18:34:51.157 回答