应用所有CSS规则后执行jQuery代码 [英] Execute jQuery code after all CSS rules have been applied

查看:126
本文介绍了应用所有CSS规则后执行jQuery代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(document).ready()在所有HTML元素均已加载后执行代码.

$(document).ready() executes the code when all HTML elements have been loaded.

在应用所有CSS规则后如何执行jQuery代码?

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.

推荐答案

$(window).load()在整个页面(图像,CSS等)加载后触发.

$(window).load() fires after the whole page (images, CSS, etc.) has loaded.

这篇关于应用所有CSS规则后执行jQuery代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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