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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| //Déclaration des variables
var numero = 0;
var tableau_photos = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg", "7.jpg", "8.jpg", "9.jpg"];
var timer;
var timer1;
var timer2;
var verif=0;
var i;
// Fonction pour se déplacer à la photo suivante
function add()
{
if(numero==tableau_photos.length-1) {numero=0;}
else {numero++;}
document.getElementById("image_1").src=tableau_photos[numero];
}
function suivante()
{
setTimeout("add()", 50);
}
// Fonction pour se déplacer à la photo précédente
function less()
{
if (numero == 0) {numero=tableau_photos.length-1;}
else {numero--;}
document.getElementById("image_1").src=tableau_photos[numero];
}
function precedente()
{
setTimeout("less()", 50);
}
//Fonction pour stoper le diaporama automatique
function stop_auto()
{
if (verif==1) {clearTimeout(timer);}
else if (verif==2) {clearTimeout(timer1);}
else if (verif==3) {clearTimeout(timer2);}
else if (verif==4) {clearTimeout(timer3);}
verif=0;
}
// Fonction pour activer le diaporama automatique avec temporisation
function auto()
{
if (document.getElementById("temps_1").checked)
{
verif=1;
suivante();
timer = setTimeout("auto()", 2000);
}
else if (document.getElementById("temps_2").checked)
{
verif=2;
suivante();
timer1 = setTimeout("auto()", 6000);
}
else if (document.getElementById("temps_3").checked)
{
verif=3;
suivante();
timer2 = setTimeout("auto()", 15000);
}
else if (document.getElementById("temps_ecran").checked)
{
verif=4;
document.getElementById("image_1").width=1200;
document.getElementById("image_1").height=812;
document.getElementById("diaporama").src="";
document.getElementById("diaporama").alt="";
document.getElementById("precedent").src="";
document.getElementById("precedent").alt="";
document.getElementById("stop").src="";
document.getElementById("stop").alt="";
document.getElementById("suivant").src="";
document.getElementById("suivant").alt="";
suivante();
timer3 = setTimeout("auto()", 2000);
}
}
function auto_debut()
{
if (verif==0) {auto();}
}
// Réinitialiser la fenêtre après un plein écran
function initialiser()
{
if (document.getElementById("image_1").width==1200)
{
stop_auto();
document.getElementById("image_1").width=1000;
document.getElementById("image_1").height=730;
document.getElementById("diaporama").src="../boutons/diaporama.gif";
document.getElementById("diaporama").alt="btn_diaporama";
document.getElementById("precedent").src="../boutons/precedent.gif";
document.getElementById("precedent").alt="btn_precedent";
document.getElementById("stop").src="../boutons/stop.gif";
document.getElementById("stop").alt="btn_stop";
document.getElementById("suivant").src="../boutons/suivant.gif";
document.getElementById("suivant").alt="btn_suivant";
}
} |
Partager