怎么实现的jQuery $(文件)。就绪()? [英] how did jquery implement $(document).ready()?

查看:110
本文介绍了怎么实现的jQuery $(文件)。就绪()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎么jQuery的实施 $(文件)。就绪()

how did jquery implement $(document).ready()?

我当然可以读取code,但我期待为理念...

of course I can read the code, but I am looking for the concept...

推荐答案

在一般情况下,
它检查浏览器已经加载body元素的DOM树,
在这种情况下,它执行CB(),而不等待其他请求(图像...)

In general, It checks if the browser already loaded the body element to the DOM tree, in that case it executes the cb() without waiting for the other requests(images...)

否则它将等待一段时间,并重新检查。

otherwise it waits sometime and recheck..

这篇关于怎么实现的jQuery $(文件)。就绪()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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