繁体   English   中英

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM