Animation funktioniert nicht

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • Animation funktioniert nicht

      so die animation nach rechts geht die nach links nicht (habs falschrum geschrieben goLeft ist eig goRight und andersrum)
      hier ist der code

      HTML-Quellcode

      1. <html>
      2. <head>
      3. <style type="text/css">
      4. .asz {
      5. background-color: #dedede;
      6. width: 200;
      7. height: 100;
      8. z-index: 0;
      9. marign: 0;
      10. padding: 0;
      11. }
      12. .asz #as {
      13. list-style:none;
      14. z-index: 1;
      15. position: relative;
      16. top: 10px;
      17. left: 0px;
      18. width: 200px;
      19. height: 80px;
      20. float:left;
      21. background-color: #AAA;
      22. }
      23. .asz #as2 {
      24. list-style:none;
      25. z-index: 2;
      26. position: relative;
      27. top: 10px;
      28. left: 0px;
      29. width: 0px;
      30. height: 80px;
      31. float:left;
      32. background-color: #FFF;
      33. }
      34. </style>
      35. <script language="javascript">
      36. var i =0;
      37. function goLeft()
      38. {
      39. if ( document.getElementById ) {
      40. document.getElementById('as').style.width = 200 - i + "px";
      41. document.getElementById('as').style.left = i/320+"px";
      42. document.getElementById('as2').style.width = i + "px";
      43. }
      44. i = i + 10;
      45. if ( i < ( 210 ) )
      46. {
      47. window.setTimeout( 'goLeft()', 40 );
      48. }
      49. }
      50. function goRight()
      51. {
      52. if ( document.getElementById )
      53. {
      54. document.getElementById('as').style.width = i + "px";
      55. document.getElementById('as').style.left = i/320+"px";
      56. document.getElementById('as2').style.width = i + "px";
      57. }
      58. i = i - 10;
      59. if ( i > ( -10 ) )
      60. {
      61. window.setTimeout( 'goRight()', 40 );
      62. }
      63. }
      64. </script>
      65. </head>
      66. <div align="center">
      67. <ul class="asz">
      68. <li id="as2" onclick="goRight()">
      69. </li>
      70. <li id="as" onclick="goLeft()">
      71. </li>
      72. </ul>
      73. </div>
      74. </body>
      75. </html>
      Alles anzeigen


      fehler: bei der rückanimation ist as unter as2
    • Werbung zur Unterstützung des Forums ( Bitte AddBlocker deaktivieren )