preload(["image1.jpg", "image2.jpg", "image3.jpg"]);
function preload(images){
for(var i=0; i<images.length; i++){
var img = new Image();
img.src = images[i];
bilder[i] = img;
}
}
<!--
// Image-Preloader
image1 = new Image();
image1.src = "thumb01.jpg";
image2 = new Image();
image2.src = "thumb02.jpg";
image3 = new Image();
image3.src = "pic03.jpg";
image4 = new Image();
image4.src = "pic04.jpg";
image5 = new Image();
image5.src = "pic05.jpg";
// swapImage
function swapImage(imgName,swapImg)
{
document.images[imgName].src=swapImg;
}
var bilder = new Array("script/thumb01.jpg","script/thumb02.jpg");
var naechstesBild = 0; //Index des nächsten Bildes
var verzoegerung = 5000; //Verzögerung in Millisekunden
function animation() {
document.pic.src = bilder[naechstesBild];
naechstesBild++;
if (naechstesBild==bilder.length) {
naechstesBild = 0;
}
setTimeout("animation();", verzoegerung);
}
//-->
Titel | Forum | Antworten | Datum | |
---|---|---|---|---|
Bedingt Images anzeigen | Angular, React, JQuery - Fragen zu JavaScript | 2 |