I know inline Javascript is frowned upon and with the new on-the-fly Javascript compressors that check for idle/unused function usage and omit the unused code, it seems good practice to have all your Javas开发者_开发问答cript in an external file.
My question is, in situations like FOUC (flash of unstyled content) which usually require little snippets of code right before the closing </body>
tag, is there a JQuery resolution that would serve the same purpose, but from a remote Javascript file linked in the <head>
of the document?
Is $(document).ready() what your looking for?
$(document).ready(function() {
// anything in here will execute when the page has finished loading
});
精彩评论