'$(document).ready()' 的非 jQuery 等价物是什么? [英] What is the non-jQuery equivalent of '$(document).ready()'?

查看:34
本文介绍了'$(document).ready()' 的非 jQuery 等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(document).ready() 的非 jQuery 等价物是什么?

What is the non-jQuery equivalent of $(document).ready()?

推荐答案

这没有回答问题,也没有显示任何非 jQuery 代码.请参阅下面@sospedra 的回答.

$(document).ready() 的好处是它在 window.onload 之前触发.加载函数会等待所有内容加载完毕,包括外部资产和图像.$(document).ready 但是,当 DOM 树完成并且可以被操作时会触发.如果你想在没有 jQuery 的情况下实现 DOM 就绪,你可以查看这个库.有人只从 jQuery 中提取了 ready 部分.它既美观又小巧,您可能会发现它很有用:

The nice thing about $(document).ready() is that it fires before window.onload. The load function waits until everything is loaded, including external assets and images. $(document).ready, however, fires when the DOM tree is complete and can be manipulated. If you want to acheive DOM ready, without jQuery, you might check into this library. Someone extracted just the ready part from jQuery. Its nice and small and you might find it useful:

Google 代码中的 domready

这篇关于'$(document).ready()' 的非 jQuery 等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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