views:

186

answers:

2

So I've got a web app that is for all intents and purposes a photo viewer.

When a thumbnail is clicked, the app

  1. requests the image asset,
  2. injects it into the DOM as an IMG tag
  3. and disposes the other

(MooTools Asset.image, inject and dispose).

If they click on an image that has already been loaded I just inject it again since dispose stores it.

Users look at the images for an average of 12 seconds (according to my stats), that's plenty of time to download a few more.

So my question again, slightly rephrased:

Is it good or bad practice to determine if I should download other assets in the background based on the movement of their mouse?

So if the mouse isn't moving, download the next few assets. If it starts moving, stop and wait for the mouse to stop (and have a little interval before starting to download again, like 1 or two seconds).

It seems like a good idea to me but it just feels like there are some secondary effects I'm not thinking about.

Gracias.

+2  A: 

To answer your question directly, I don't think there will be an issue except that checking for mouse movement will have a degree of performance overhead. I would measure the performance on a slow machine, once you are done, to see if this is a problem.

cbp
The event is fired any way...
Itay Moav
Good point, so performance is unlikely to be an issue unless you happen to be doing too much in the onmousemove function.
cbp
+2  A: 

You might make your back and forward buttons have bigger areas (white/transparent backgrounds) and check for mouseover on those backgrounds and load the images when the cursor is on those areas. Basically load the image right before the user clicks the button.

Lucas McCoy
That's a unique idea. Can't do it without an interface overhaul since the prev/next buttons have other controls around them (and there's keyboard navigation also so I wouldn't know their finger was over the 'right' key). I'm going to mull over that concept of checking for :hover rather than mousemove.
rpflo
Yeah I totally forgot about keystrokes. Maybe your company could sell them a unique keyboard that COULD tell which key their finger was hovering over just for the purpose of preloading images. ;-)
Lucas McCoy