|
|
|
|
wmikke
|
| Slideshow met stopknop - Posted on: 27-07-2005 at 12:07 | |

|
Dit is een 'update' van het script Fading foto's en een reactie op dit forum bericht, http://www.scriptzine.nl/forum/read_post.php?pid=36.
Plak dit tussen je <head></head> tags:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
|
<script>
// speed of your slideshow (in milliseconds)
var SlideShowSpeed = 2000;
// duration off the crossfade (in seconds)
var CrossFadeDuration = 5;
var Picture = new Array(); //
var Caption = new Array(); //
// Below this line you can add more images
// besure to edit the Picture[?] number
Picture[1] = 'img1.ext';
Picture[2] = 'img2.ext';
// =====================================
// Do not change a thing below this line
var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;
var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}
function runSlideShow(){
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=4)";
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.images.PictureBox.src = preLoad[jss].src;
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout("runSlideShow()", SlideShowSpeed);
}
function buttonCheck() {
if(document.animForm.animButton.value == "Stop") {
document.animForm.animButton.value = "Start";
clearTimeout(tss);
tss = null;
}
else
{
document.animForm.animButton.value = "Stop";
runSlideShow();
}
}
</script>
|
|
|
Je body tag moet er zo uitzien:
1 2
|
|
<body onLoad=runSlideShow>
|
|
|
En tussen je <body onLoad=runSlideShow></body> tags:
1 2 3 4 5 6 7 8 9 10 11
|
|
<img src=img1.ext name=PictureBox width=420 height=310><P>
<FORM NAME="animForm">
<INPUT TYPE=button VALUE=Stop NAME="animButton" onClick=buttonCheck()>
</FORM>
<SCRIPT>
document.animForm.animButton.value = "Stop";
</SCRIPT>
|
|
|
|
|
|
|
|