On Tue, Dec 9, 2008 at 9:03 AM, darwin liem <[EMAIL PROTECTED]> wrote:
> Naaah, I've check this one... it still load all the image in view port...
> what I want to achieve is that some sort of
> var imgtemp = new Image(); which will cache image however this only works
> for img tags not background... I cant find API nor plugins for this
> solution. does anyone have any idea or a workaround?

So, create the Image objects and, when they've loaded, assign the src
attribute to the background of whatever elements you wish to have
them. Something like:

var imgtemp = new Image();
imgtemp.src = '...';

I'm not sure if you could set the following as a load() handler on
imgTemp, as it's not in the DOM.

$('some_element').css('backgroundImage','url(' + imgTemp.src +')');

Reply via email to