在DOM准备好之后但呈现UI之前,如何使用jquery进行操作? [英] How to do something with jquery after the DOM is ready but before the UI is rendered?

查看:96
本文介绍了在DOM准备好之后但呈现UI之前,如何使用jquery进行操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jQuery脚本,用于更改<img>的src属性和其他一些页面元素.

I have a jQuery script that changes the src attribute of an <img> and a few other page elements.

我的脚本使用$()挂接到了文档就绪的回调中.刷新页面时,我会看到原始内容半秒钟.我想避免这种情况.

My script is hooked to the document-ready callback using $(). When I refresh the page I see the original content for half a second. I want to avoid that.

有没有一种方法可以让我的脚本在DOM准备就绪后之后但在之前执行?

Is there a way for my script to execute after the DOM is ready but before it is rendered?

推荐答案

我认为这是不可能的.如今,浏览器在DOM完成构建之前就开始呈现UI.

I don't think it's possible. These days, browsers begin rendering the UI before the DOM has finished building.

这篇关于在DOM准备好之后但呈现UI之前,如何使用jquery进行操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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