JQuery 附加问题淡入淡出效果


JQuery Additional Questions Fade Effect

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

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

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

现在它每 3 秒工作一次内容更改。我首先在文本上尝试它,以便更容易。稍后我打算在图片上做。

您可以向

要发出的 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())。