是jQuery的淡入(),动画()函数非阻塞? [英] Are jQuery fadeIn(), animation() functions non-blocking?

查看:146
本文介绍了是jQuery的淡入(),动画()函数非阻塞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,其中问题的若干阿贾克斯查询在 $('文件')。就绪()。我想用淡入()动画()来显示一些信息几秒钟收到后的第一个AJAX呼叫。

将以下JS / AJAX调用中的动画播放过程中受阻?或者,我应该使用的setTimeout延迟动画第二个这样的Ajax调用可以异步启动?

编辑:

我的code会是这样的。请问别人Ajax调用被阻塞5秒?

  $阿贾克斯({...,成功:函数(结果){
    $('#味精)HTML(result.xxx);
    $('#味精)淡入(5000)。

    //其他Ajax调用
    $阿贾克斯(....)
    ....
}
 

解决方案

是的,他们是无阻塞。动画方法只是启动动画,并立即返回。

不限code表示更新用户接口必须非阻塞的,因为任何功能运行的同时在用户界面不更新

I have a page which issues several ajax queries in $('document').ready(). I want to use fadeIn() or animation() to display some information for a few seconds after received the first ajax call.

Will the following js/ajax calls be blocked during the animation playing? Or should I use setTimeout to delay the animation a second so the ajax calls can be started asynchronously?

Edit:

My code will look like this. Will the others ajax calls be blocked for 5 seconds?

$.ajax({..., success: function(result) {
    $('#msg').html(result.xxx);
    $('#msg').fadeIn(5000);

    // Other ajax calls
    $.ajax(....)
    ....
}

解决方案

Yes, they are non-blocking. The animation methods just initiate the animation and returns immediately.

Any code that updates the user interface has to be non-blocking, as the user interface isn't updated while any function is running.

这篇关于是jQuery的淡入(),动画()函数非阻塞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆