Bonjour à tous !
Développant un site php, on ma demandé de faire un diaporama de photos d'un dossier. Pour charger les images avec php ça me pose aucun problème mais en javascript je suis bloqué.
voici mon script :
J'ai un boutton qui lance la fontion startpix(). je voudrais pouvoir aretter le défilement (diaporama) des images mais je n'y arrive pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <SCRIPT LANGUAGE="JavaScript"> <!-- var timeDelay = 5; var Pix = new Array ( "images/album_video.gif" , "images/album_texte.gif" , "images/album_url.gif" , "images/album_dossier.gif" ); var howMany = Pix.length; timeDelay *= 100; var PicCurrentNum = 0; var PicCurrent = new Image(); var run = 0; PicCurrent.src = Pix[PicCurrentNum]; function startpix() { if (run == 0) { run = run + 1; setInterval("slideshow()", timeDelay); } if (run == 1) { setInterval("slideshow()", 0); run = 0; } } function slideshow() { if (run == 1) { PicCurrentNum++; if (PicCurrentNum == howMany) { PicCurrentNum = 0; } PicCurrent.src = Pix[PicCurrentNum]; document["ChangingPix"].src = PicCurrent.src; } } // End --> </script>
Ne connaissant rien en javascript j'ai essayé avec increment(run) mais ça marche pas non plut.
Comment faire pour bloquer la fonction?
Partager