Witam mam już funkcje flip która obraca obrazek i pokazuje jego drugą strone ( tak jakby ) i z powrotem się okręca.
Ale chodzi mi o to jak zrobić żebym mógł naprzykłąd okręcać karte i za każdym razem widzieć inny obraz.
Czyli przykładowo mam 6 obrazków i chcę żeby o na się pokazywały po kolei po obrocie na karcie.
Jak zmodyfikować kod albo ewentualnie może jest prostsza funkcja od tej.
<script language="JavaScript" type="text/javascript">
<!--hide
//STEP 1: PUT THIS CODE INTO THE HEAD OF YOUR DOCUMENT
var wdmax=140; //set maximum width of square image (px)
var wdmin=0; //set minimum thickness of edge-on image (px)
var inc=5; //set step change in px (wdmax-wdmin must be a multiple) )These two variables
var rate = 50; //pause between steps (in millisec) )determine flip-flop speed
var pause = 1000; //pause between flip and flop (in millisec)
var ff="flip"; //initialise whether movement starts with a "flip" (sideways) or "flop" (vertical) change.
function flipflop() {
if (ff=="flip") {
var wd = document.getElementById("pic").getAttribute("height");
wd = wd - inc;
document.getElementById("pic").setAttribute("height",wd);
if (wd==wdmin) {
document.getElementById("pic").setAttribute("src","bcard2.png"); //substitute name of your second picture
inc=-inc;
}
if (wd==wdmax) {
ff="flop";
inc=-inc;
setTimeout("flipflop()",4000);
}
else {
setTimeout("flipflop()",rate);
}
}
else {
var ht = document.getElementById("pic").getAttribute("height");
ht = ht - inc;
document.getElementById("pic").setAttribute("height",ht);
if (ht==wdmin) {
document.getElementById("pic").setAttribute("src","bcard1.png"); //substitute name of your first picture
inc=-inc;
}
if (ht==wdmax) {
ff="flip";
inc=-inc;
setTimeout("flipflop()",2000);
}
else {
setTimeout("flipflop()",rate);
}
}
}
Proszę o pomoc.