AaronW
09-06-2006, 04:39 PM
At the beginning of my script, I define an element like this, basically:
var box_element = document.createElement ('div');
box_element.className = 'box';
I wrote an onload function that sniffs out elements of a certain classname. Upon finding each one, it clones the box_element DIV, positions it to the upper left of the found element, and appends it to the body element. Now, the process of cloning, positioning, and appending the elements is done pretty much immediately in IE. The problem I'm facing is that IE loads the background image for each box (defined in the .box rule of the @imported CSS document) one by one, and slowly enough that I can watch them draw in a line down the page. It's not slowly enough that I can count them as they go, but it's slow enough to indicate that IE is actually fetching the background image each time, discarding it, then re-fetching it; it isn't caching the image.
So, does anyone know why? Or how I'd coax it into caching it? Or am I just stuck? The only reason this is a concern for me is that the background image of the element makes up the entire element. Its background colour is nothing, and the image is an icon of a pecil indicating that the element can be edited. So the effect is that of a slow-loading UI, which just won't do!
Thanks for any suggestions.
var box_element = document.createElement ('div');
box_element.className = 'box';
I wrote an onload function that sniffs out elements of a certain classname. Upon finding each one, it clones the box_element DIV, positions it to the upper left of the found element, and appends it to the body element. Now, the process of cloning, positioning, and appending the elements is done pretty much immediately in IE. The problem I'm facing is that IE loads the background image for each box (defined in the .box rule of the @imported CSS document) one by one, and slowly enough that I can watch them draw in a line down the page. It's not slowly enough that I can count them as they go, but it's slow enough to indicate that IE is actually fetching the background image each time, discarding it, then re-fetching it; it isn't caching the image.
So, does anyone know why? Or how I'd coax it into caching it? Or am I just stuck? The only reason this is a concern for me is that the background image of the element makes up the entire element. Its background colour is nothing, and the image is an icon of a pecil indicating that the element can be edited. So the effect is that of a slow-loading UI, which just won't do!
Thanks for any suggestions.