Execute jQuery code after all CSS rules have been

2020-03-19 20:44发布

$(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.

2条回答
甜甜的少女心
2楼-- · 2020-03-19 21:15

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

查看更多
手持菜刀,她持情操
3楼-- · 2020-03-19 21:32
$(window).load(function() {

 // executes when complete page is fully loaded, including all frames, objects and images

 alert("window is loaded");

});
查看更多
登录 后发表回答