Salve, ho la necessità di far in modo che un elemento (un div con background un immagine) si sposti da sinistra a destra fino a raggiungere 900px su margin-left, ho usato questo codice ma manda subito il callback:
codice:
<html>
<head>
<title>Test animazione</title>
<script type="text/javascript" src="http://www.html.it/guide/esempi/jquery/esempi/jquery-1.3.2.js"></script>
<script type="text/javascript">
function test_animate () {
$("#pacman").animate({
"margin-left" : "+=900px"
},
"fast",
"linear",
function () {
alert("Animazione conclusa!");
}
);
}
</script>
</head>
<body onLoad="test_animate();">
<div id="pacman" style="background: url(pacman.gif); width: 32px; height: 32px; margin-left: 0px;"></div>
</body>
</html>
Come devo modificare? Grazie in anticipo.