Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5. <meta charset="UTF-8">
  6. <link rel="stylesheet" type="text/css" href="style.css">
  7. <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  8. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  9.  
  10. <script>
  11.  
  12.  
  13. var dupa_2;
  14. var dupa;
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. function gora(){
  23. clearInterval(dupa_2);
  24. var czas = 400;
  25. var ilosc = document.getElementsByTagName("p").length;
  26. for (i = 1; i <= ilosc; i++){
  27. var p = $("#"+i);
  28. p.animate({backgroundColor: "black"}, 500+(ilosc-i)*czas);
  29. p.animate({backgroundColor: "white"}, 5+i*czas);
  30.  
  31.  
  32. }
  33. dupa = setInterval(gora(), 4000);
  34. };
  35.  
  36.  
  37. function dol(){
  38. clearInterval(dupa);
  39. var czas = 550;
  40. var liczbaid = document.getElementsByTagName("p");
  41. for (i = 1; i <= liczbaid.length; i++){
  42. var p = $("#"+i);
  43. p.animate({backgroundColor: "#0066ff"}, 500+i*czas);
  44. p.animate({backgroundColor: "white"}, 500+i*czas);
  45.  
  46. };
  47. dupa_2 = setInterval(dol(), 9000);
  48. };
  49.  
  50.  
  51.  
  52.  
  53. </script>
  54.  
  55. </head>
  56.  
  57. <body>
  58.  
  59. <p id="1">a </p>
  60. <p id="2"> b</p>
  61. <p id="3">c </p>
  62. <p id="4"> d</p>
  63.  
  64.  
  65.  
  66. <button onClick="gora()" id="gora">Góra</button>
  67. <button onClick="dol()" id="dol">Dół</button>
  68. </body>
  69.  
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement