Hi,

I guess most of you are aware of the peformance tip: put JavaScript at
the bottom of the page.

Now, what I have seen on quite a few pages is that the jquery.js is
placed in the header, and a file with all the code inside $
(document).ready somewhere before the </body> tag.

What are the benefits of this approach? Why not putting both files at
the bottom, and maybe even merging them into one file to be placed at
the bottom (which would also mean that you have one http request
less)?

One explanation I was thinking about: If you put both scripts at the
bottom, the page renders faster, but the delay until certain
functionality is available, elements get hidden etc. is greater
compared to having the library in the head and the $(document).ready
script at the bottom. So it would be a compromise between page loading
time and availability of functionality on the page.

Could this be a possible reason, or I am being on the wrong track
here? :)

Cheers

Reply via email to