Is there a way to execute jQuery code before the DOM is ready ?
If you include jQuery in the head of your document, and then write your code in another script tag in the head, it will run before the DOM is ready:
However, obviously you won't be able to interact with any DOM elements, since they won't exist yet.
Having said that, there is a technique you can use in modern browsers that can allow you to interact with DOM elements as they are inserted into the page (while the browser is rendering it). It relies upon CSS animation events. I've written a simple library (Progressive.js) to make this easier to handle.