so i cant check whether the image is really cache or not? can we bind onload()? 
to image?
for example:

$("image_id").bind("onload",function(){
imgtemp.src = '...';
$(this).css('backgroundImage','url('+imgTemp.src +')');
});

Best Regards

Darwin Liem

--- On Tue, 12/9/08, brian <[EMAIL PROTECTED]> wrote:
From: brian <[EMAIL PROTECTED]>
Subject: [jQuery] Re: how to image cache using jQuery?
To: jquery-en@googlegroups.com
Date: Tuesday, December 9, 2008, 12:24 PM

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