Skip to content Skip to sidebar Skip to footer

How To Load Jquery Before Dom Is Ready

I want to load some jQuery code before the DOM is ready. I want to make a flash file transparant as the DOM loads. I was going to use something like this but Flash is initilized be

Solution 1:

ready() is the earliest point at which you can safely access arbitrary DOM elements.

You could put a script block directly after you declare the object tag: That should work, you will have access to the object element.

However, I don't think even that will help you: As far as I know, Flash won't accept a JavaScript-side changing of the wmode parameter anyway.

You would have to put wmode.transparent into the HTML, or create the Flash movies dynamically when the DOM is loaded.

Solution 2:

Using javascript before the dom is loaded will yield to unpredictable results. Modify your html code as you wish, but do not use javascript.

Solution 3:

The safest way is to construct the object or embed element on dom ready event:

<div id="flash"></div>

$(document).ready(function(){
   var htm= '<object ...><param name="some" value="val" ... /></object>';
   $('#flash').html(htm);

});

Post a Comment for "How To Load Jquery Before Dom Is Ready"