TH1981
TH1981

Reputation: 3193

Can you specify the load order for page elements?

I think I know the answer to this, but want to make sure I've not missed something...

I have a webpage that has a small, flash logo animation at the top of the screen. I've kept it minimal and it's just a logo, so no critical navigation or anything silly in there. Because it's the first large element to load however, it's sometimes hangs the page a bit and slows everything else down.

Is there a way to tell it the page to load that flash element last? It's the only flash element and I've already implemented jquery on the page (I don't know if that gives me an option?)

Thanks in advance!

Upvotes: 2

Views: 1456

Answers (3)

Linus Kleen
Linus Kleen

Reputation: 34652

You might set an event listener for the page's onload event and then have the flash load.

Excuse the pseudo-code. I'm not fluent in jQuery.

document.body.onload = function()
   {
       var element = $('#flash_container');
       element.src = 'flash.swf';
   }

Upvotes: 1

Gabriele Petrioli
Gabriele Petrioli

Reputation: 196236

You should use swfobject and/or jquery to embed the flash (in other words dynamically embed) after the document has completed loading or the DOM is ready (whatever suits your needs).

Upvotes: 0

Timbadu
Timbadu

Reputation: 1551

I'm no expert but... You could try wrapping it in a div and placing it last in your html code.

If it sits at the top then position: absolute; top: 0; could be fairly straight forward.

Upvotes: 0

Related Questions