wucher wichtel: Animierter Layer

Beitrag lesen

Hallo!

Hmm habe es versucht einzusetzten aber leider klappt sich jetzt der Layer nach 10 sek zu ?

Hast du im CSS angegeben, dass die Box die Höhe 0px hat?

<script language="JavaScript" type="text/javascript">
var pixel = 0;

function animation() {
var elem = document.getElementById("ani").style;
elem.height = pixel + "px";
pixel = pixel + 5;

if ( pixel == 200 ) { // Wenn der Bereich höher als 200px wird, dann...
  clearInterval(neu);
}
}
window.onload = function() { neu = window.setTimeout("animation()", 10000) };
</script>

Du musst eine Funktion per setTimeout aufrufen. Diese Funktion ruft dann per setInterval die andere auf.

  
function startAnimation() {  
 starte = window.setInterval("animation()", 20);  
}  
  
function animation() {  
 var elem = document.getElementById("ani").style;  
 elem.height = pixel + "px";  
 pixel = pixel + 5;  
  
 if ( pixel == 200 ) { // Wenn der Bereich höher als 200px wird, dann...  
  clearInterval(starte);  
 }  
}  
  
window.onload = function() { neu = window.setTimeout("startAnimation()", 10000) };  

So müsste es funktionieren.

ciao, ww

--
sh:(  fo:|  ch:~  rl:(  br:>  n4:~  ie:%  mo:)  va:)  de:]  zu:)  fl:(  ss:|  ls:~  js:)