Rob Fracisco

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromRob Fracisco
ToMe
SubjectPossible to not cache images
Date10 March 2006 00:28
hello,

i love your script. i've used it on my personal site off and on over the
years. i really love the simplicity in the html markup.

i'm currently making a site for friend of mine with an image gallery. the
page will be loading a lot of images and we're having issues with the way
the script pre-loads all the hoversrc images on window load. i've attempted
to play with the script to remove this function, but i am not very skilled
with javascript.

i'm basically looking for some guidance on how to make the imgRoll.js not
preload images and only load the hoversrc image on mouseover.

any help is greatly appreciated,
rob
FromMe
ToRob Fracisco
SubjectRe: Possible to not cache images
Date10 March 2006 08:59
Rob,

> i'm currently making a site for friend of mine with an image gallery. the
> page will be loading a lot of images and we're having issues with the way
> the script pre-loads all the hoversrc images on window load.

I must advise against this for a couple of reasons;

1. it makes the rollover animation feel slow and may appear to fail to
respond for a while

2. In some browsers, the image will not change until the _second_ time you
move your mouse over it.

However, if you decide that you still want to disable caching, that is easy
enough to do. There are three lines in the code that look something like
this:

if( !MWJ_img_cache[im.hoversrc] ) {
 MWJ_img_cache[im.hoversrc] = new Image();
 MWJ_img_cache[im.hoversrc].src = im.hoversrc; }

Remove all three of those lines, and it will no longer cache anything.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromRob Fracisco
ToMe
SubjectRe: Possible to not cache images
Date11 March 2006 18:06
awesome.. that actually worked out good. we're really only concerned with
supporting the latest browsers; IE6, safari, firefox, opera..
[Ed. *sigh*]

thanks alot,
rob
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.