code javascript pour fondu enchaîné
Bonjour,
Merci pour ce forum.
Il peut me sauver du désespoir de ne pas être développeur... :roll:
J'ai créé un diaporama perso en glanant des codes ici et là.
Il ne manque que le fondu enchaîné, et je ne comprends rien !
Voici mes codes - dans le head> :
Code:
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
| <script type="text/javascript" language="JavaScript">
var current = 0;
function next(){ // forward one image
if(document.formname.slide[current+1]){
document.images.show.src = document.formname.slide[current+1].value;
document.formname.slide.selectedIndex = ++current;}
else{first();}}
function previous(){ // back on image
if((current-1) >= 0){
document.images.show.src = document.formname.slide[current-1].value;
document.formname.slide.selectedIndex= --current;}
else{last();}}
function first(){ // jump to first image
current=0;
document.images.show.src = document.formname.slide[0].value;
document.formname.slide.selectedIndex=0;}
function last(){ // this is jump to last image
current=(document.formname.slide.length-1);
document.images.show.src = document.formname.slide[current].value;
document.formname.slide.selectedIndex=current;}
function ap(text){ // this controls the auto-play and/or auto-stop
document.formname.slidebutton.value=(text == "Stop") ? "Start" : "Stop";
rotate();}
function change(){ // this is for the pulldown menu
current=document.formname.slide.selectedIndex;
document.images.show.src = document.formname.slide[current].value;}
function rotate() {
if (document.formname.slidebutton.value == "Stop") {
current = (current == document.formname.slide.length-1) ? 0 : current+1;
document.images.show.src = document.formname.slide[current].value;
document.formname.slide.selectedIndex = current;
window.setTimeout("rotate()", 4000);}}
// End -->
</script> |
et dans le body> :
Code:
<form name="formname" action="diaporama">
avec un tableau dans lequel une première image
Code:
<img src="image0.jpg" name="show">
Puis :
Code:
1 2 3 4
| <select id="slide" onchange="change()"
<option value="image1.jpg">blabla</option>
<option value="image2.jpg">blabla</option>
<option value="image3.jpg">blabla</option> |
etc.
La suite n'a pas d'intérêt je crois...
Que dois-je faire, Docteur, pour que les enchaînements soient fondus ?
Merci infiniment !
Yvo
pb plusieurs fondu enchainé
bonjour bovino,
Je te joins le code inséré dans le <body> car ça ne marche pas et je ne comprends pas pourquoi :
Code:
<body onload="window.monFondu_1 = new Fondu('images1');window.monFondu_2 = new Fondu('images2');window.monFondu_3 = new Fondu('images3');setInterval(function(){monFondu.change(true);},2500);">
Le script en <head> est le tien, tel qu'écrit en premier message.
Merci.