Ho fatto una funzione che al click su un immagine richiama una funzione che fa scorrere delle immagini. Adesso voglio fare in modo che al click su un altra immagine le immagini scorrano nella direzione opposta a prima. Questo è quello che ho fatto fino ad adesso:
Codice PHP:
<html>
<head>
<style type="text/css">
#container {
position:relative;
width:424px;
height:70px;
overflow:hidden;
}
#div1 {
position:absolute;
left:0px;
top:0px;
width:424px;
height:106px;
}
#div2 {
position:absolute;
left:424px;
top:0px;
width:424px;
height:106px;
}
img {
border:1px solid #000;
margin:2px;
float:left;
}
</style>
<script type="text/javascript">
var a=0;
var b=424;
function sx() {
document.getElementById('div1').style.left=a+'px';
document.getElementById('div2').style.left=b+'px';
a--;
b--;
if(a==-424) {
a=424;
}
if(b==-424) {
b=424;
}
setTimeout('sx()',20);
}
</script>
</head>
<body>
<table>
<tr>
<td>
[img]Freccia_sx.png[/img]
</td>
<td>
<div id="container">
<div id="div1">
[img]linux.gif[/img]
[img]mysql.gif[/img]
[img]php.gif[/img]
[img]ubuntu.gif[/img]
</div>
<div id="div2">
[img]linux.gif[/img]
[img]mysql.gif[/img]
[img]php.gif[/img]
[img]ubuntu.gif[/img]
</div>
</div>
</td>
<td>
[img]Freccia_sx.png[/img]
</td>
</tr>
</table>
</body>
</html>