L'effet de l'image du carrousel est illustré dans la figure ci-dessous. Les images peuvent être pivotées d'elles-mêmes. Cliquez sur les boutons gauche et droit pour tourner les pages du carrousel. Passez la souris sur l'image ou le titre pour arrêter le carrousel.
Le rendu est :
Copiez le code comme suit :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<tête>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Carrousel d'images avec flèches gauche et droite</title>
<style type="text/css">
<!--
.rollBox{largeur:770px;hauteur:260px;débordement:caché;padding:10px;marge:0 auto;bordure:1px rouge uni;}
.rollBox .LeftBotton{hauteur:40px;largeur:21px;arrière-plan:url(images/sl.png) sans répétition 0px 5px;débordement:caché;float:gauche;affichage:inline;marge:110px 0 0 0;curseur : aiguille;}
.rollBox .RightBotton{hauteur:40px;largeur:21px;arrière-plan:url(images/sr.png) sans répétition 0px 5px;débordement:caché;float:gauche;affichage:inline;marge:110px 0 0 0;curseur : aiguille;}
.rollBox .Cont{largeur:726px;débordement:caché;float:gauche;}
.rollBox .ScrCont{largeur:10000000px;}
.rollBox .Cont .pic{width:242px;float:left;text-align:center;}
.rollBox .Cont .pic img{padding:9px;background:#fff;border:1px solid #ccc;display:block;margin:0 auto;width:190px;height:190px;}
.rollBox .Cont .pic div{line-height:20px;color:#505050;margin:15px 0px;}
.rollBox .Cont .pic div span{display:block;}
.rollBox .Cont a:link,.rollBox .Cont a:visited{color:#626466;text-decoration:none;}
.rollBox .Cont a:hover{color:#f00;text-decoration:underline;}
.rollBox #Liste1,.rollBox #Liste2{float:gauche;}
-->
</style>
</tête>
<corps>
<div>
<div onmousedown="ISL_GoUp()" onmouseup="ISL_StopUp()" onmouseout="ISL_StopUp()"></div>
<div id="ISL_Cont">
<div>
<div id="Liste1">
<!-- Début de la liste d'images -->
<div>
<a href="/" target="_blank"><img src="images/1.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<div>
<a href="/" target="_blank"><img src="images/2.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<div>
<a href="/" target="_blank"><img src="images/3.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<div>
<a href="/" target="_blank"><img src="images/4.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<div>
<a href="/" target="_blank"><img src="images/5.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<div>
<a href="/" target="_blank"><img src="images/6.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<div>
<a href="/" target="_blank"><img src="images/7.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<div>
<a href="/" target="_blank"><img src="images/8.jpg" /></a>
<div>
<span><a href="//www.VeVB.COm/" target="_blank">Code du site sympa-effets spéciaux 1</a></span>
<span>45446547</span>
</div>
</div>
<!-- Fin de la liste d'images -->
</div>
<div id="Liste2"></div>
</div>
</div>
<div onmousedown="ISL_GoDown()" onmouseup="ISL_StopDown()" onmouseout="ISL_StopDown()"></div>
</div>
</corps>
<langage de script="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
//Liste défilante d'images VeVB.COm
var Vitesse = 1; //Vitesse (millisecondes)
var Space = 5; //Déplacer à chaque fois (px)
var PageWidth = 726; //Largeur de la page
var fill = 0; //décalage global
var MoveLock = faux ;
var MoveTimeObj;
varComp = 0 ;
var AutoPlayObj = null ;
GetObj("Liste2").innerHTML = GetObj("Liste1").innerHTML;
GetObj('ISL_Cont').scrollLeft = remplir;
GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}
GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}
Lecture automatique();
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
function AutoPlay(){ //Défilement automatique
clearInterval(AutoPlayObj);
AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',3000 //Intervalle);
}
function ISL_GoUp(){ //Commence à apparaître
si (MoveLock) retour ;
clearInterval(AutoPlayObj);
MoveLock = vrai ;
MoveTimeObj = setInterval('ISL_ScrUp();',Speed);
}
function ISL_StopUp(){ //Arrêtez d'apparaître
clearInterval(MoveTimeObj);
if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0){
Comp = remplir - (GetObj('ISL_Cont').scrollLeft % PageWidth);
CompScr();
}autre{
MoveLock = faux ;
}
Lecture automatique();
}
function ISL_ScrUp(){ //Action vers le haut
if(GetObj('ISL_Cont').scrollLeft <= 0){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth}
GetObj('ISL_Cont').scrollLeft -= Espace ;
}
function ISL_GoDown(){ //Baisser
clearInterval(MoveTimeObj);
si (MoveLock) retourne ;
clearInterval(AutoPlayObj);
MoveLock = vrai ;
ISL_ScrDown();
MoveTimeObj = setInterval('ISL_ScrDown()',Speed);
}
function ISL_StopDown(){ //Arrêtez de baisser
clearInterval(MoveTimeObj);
if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 ){
Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill;
CompScr();
}autre{
MoveLock = faux ;
}
Lecture automatique();
}
function ISL_ScrDown(){ //Action de défilement vers le bas
if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth){GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;}
GetObj('ISL_Cont').scrollLeft += Espace ;
}
fonction CompScr(){
varnum;
si(Comp == 0){MoveLock = false;return;}
if(Comp < 0){ //apparaît
si(Comp < -Espace){
Comp + = Espace ;
num = Espace ;
}autre{
num = -Comp;
Comp = 0 ;
}
GetObj('ISL_Cont').scrollLeft -= num;
setTimeout('CompScr()',Vitesse);
}else{ //Refuse
if(Comp > Espace){
Comp -= Espace ;
num = Espace ;
}autre{
num = Comp;
Comp = 0 ;
}
GetObj('ISL_Cont').scrollLeft += num;
setTimeout('CompScr()',Vitesse);
}
}
//--><!]]>
</script>
</html>