0

I am adding a style sheet to the head of the HTML page via the Jquery appendTo API. Once appended it appears the browser goes off and downloads the style sheet and referenced images and then applies the changes to the page.

How can I detect after this page has been updated? I.E. once its done downloading and done applying the CSS Style sheet that was added via appentTo?

Thanks!

w.donahue
  • 10,790
  • 13
  • 56
  • 78

4 Answers4

0

don't know if this works at all, but try to run document ready inside a function after the append function.

Spoeken
  • 2,549
  • 2
  • 28
  • 40
0

Usually browsers trigger image download when they detect that image is used for rendering. So if you have styles with images that are not applied to any elements the images will not be downloaded.

The only event that is possible to generate in this respect is window.onload() - all (fuzzy term) resources initially declared in visible elements are arrived. See: https://developer.mozilla.org/en/DOM/window.onload .

c-smile
  • 26,734
  • 7
  • 59
  • 86
0

You can you do it like this:

$("head").append("some.css").bind('onreadystatechange load', function()
{
   alert(1);
});
Fenec
  • 1,224
  • 13
  • 21
0

You probably also want to consider preloading images and such. Easy and good way of doing it: http://jsfiddle.net/yWntc/12/

Spoeken
  • 2,549
  • 2
  • 28
  • 40