Difference between revisions of "Template:TecCEM/JsTeam"

Line 194: Line 194:
 
         })
 
         })
 
         .on("mouseleave", def)
 
         .on("mouseleave", def)
 +
function preloadImages(array) {
 +
    if (!preloadImages.list) {
 +
        preloadImages.list = [];
 +
    }
 +
    var list = preloadImages.list;
 +
    for (var i = 0; i < array.length; i++) {
 +
        var img = new Image();
 +
        img.onload = function() {
 +
            var index = list.indexOf(this);
 +
            if (index !== -1) {
 +
                // remove image from the array once it's loaded
 +
                // for memory consumption reasons
 +
                list.splice(index, 1);
 +
            }
 +
        }
 +
        list.push(img);
 +
        img.src = array[i];
 +
    }
 +
}
 +
 +
preloadImages(["https://static.igem.org/mediawiki/2018/d/db/T--TecCEM--ro.jpeg",
 +
"https://static.igem.org/mediawiki/2018/e/e5/T--TecCEM--joe.jpeg",
 +
"https://static.igem.org/mediawiki/2018/a/a7/T--TecCEM--mille.JPG",
 +
"https://static.igem.org/mediawiki/2018/b/be/T--TecCEM--alex.jpg",
 +
"https://static.igem.org/mediawiki/2018/f/fb/T--TecCEM--sha.jpeg",
 +
"https://static.igem.org/mediawiki/2018/5/5f/T--TecCEM--ari.jpeg",
 +
"https://static.igem.org/mediawiki/2018/b/b7/T--TecCEM--uri.JPG",
 +
"https://static.igem.org/mediawiki/2018/d/de/T--TecCEM--rulo.jpg",
 +
"https://static.igem.org/mediawiki/2018/5/56/T--TecCEM--Rock.jpeg",
 +
"https://static.igem.org/mediawiki/2018/4/44/T--TecCEM--pam.jpeg",
 +
"https://static.igem.org/mediawiki/2018/3/3b/T--TecCEM--bast.jpeg",
 +
"https://static.igem.org/mediawiki/2018/1/1d/T--TecCEM--borre.JPG",
 +
"https://static.igem.org/mediawiki/2018/c/cb/T--TecCEM--arman.jpeg",
 +
"https://static.igem.org/mediawiki/2018/5/5b/T--TecCEM--edga.jpeg",
 +
"https://static.igem.org/mediawiki/2018/6/60/T--TecCEM--majo.JPG"
 
})
 
})
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 00:15, 15 October 2018