应用所有 CSS 规则后执行 jQuery 代码
$(document).ready()
在加载所有 HTML 元素后执行代码。
应用所有 CSS 规则后如何执行 jQuery 代码?
我几乎没有链接到该页面的样式表,并且加载该页面需要一些时间。元素布局在加载期间发生变化。
出于可用性目的,我需要在所有元素都有目标大小后更正元素布局。否则我会得到这些元素的错误大小。
现在我在焦点上或超时后执行此操作,但在页面加载后需要此操作。
$(document).ready()
executes the code when all HTML elements have been loaded.
How to execute jQuery code after all of the CSS rules have been applied?
I have few stylesheets linked to the page and it takes some time to load the page. Element layout changes during the time of the loading.
For usability purposes I need to correct the element layout after all of them have target sizes. Otherwise I get wrong sizes of those elements.
Now I do it on focus or after some timeout, but need this after the page loads.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
$(window).load()
在整个页面(图像、CSS 等)加载后触发。$(window).load()
fires after the whole page (images, CSS, etc.) has loaded.