views:

24

answers:

2
A: 

are you preloading the image?

Diesal11
No its downloaded only after change. post you question in comments
Paniyar
Yes i know, im new here, sorry.EDIT: if you aren't pre-loading then thats probably why it's flickering, try filling the image div with something while it loads, then once it has loaded change it to the image.
Diesal11
+1  A: 

You could pre-select the images you are about to load and store it in a persistent array:

var image_paths = new Array();
/* fill image_paths */

window.preload_images = new Array();

for (var i in image_paths) {
    var image_src = image_paths[i];
    var img = new Image();
    img.src = image_src;
    preload_images.push(img);
}

This will tell the DOM to load the image into a JavaScript Image object but to not destroy it unless preload_images is unset.

amphetamachine