Advertisement
naocrrds

on hover bouncing image infinite

May 16th, 2022 (edited)
2,146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <style>
  2. .img-infinitebouncehover {
  3. -webkit-animation-duration: 1s;
  4. animation-duration: 1s;
  5. -webkit-animation-fill-mode: both;
  6. animation-fill-mode: both;
  7. -webkit-animation-timing-function: ease-in-out;
  8. animation-timing-function: ease-in-out;
  9. -webkit-animation-iteration-count: infinite;
  10. animation-iteration-count: infinite;
  11. }
  12.  
  13. .img-infinitebouncehover:hover {
  14. -webkit-animation-name: bounces;
  15. animation-name: bounces;
  16. }
  17.  
  18. @-webkit-keyframes bounces {
  19. 0%, 100%, 20%, 50%, 80% {
  20. -webkit-transform: translateY(0);
  21. transform: translateY(0);
  22. }
  23. 40% {
  24. -webkit-transform: translateY(-30px);
  25. transform: translateY(-30px);
  26. }
  27. 60% {
  28. -webkit-transform: translateY(-15px);
  29. transform: translateY(-15px);
  30. }
  31. }
  32.  
  33. @keyframes bounces {
  34. 0%, 100%, 20%, 50%, 80% {
  35. -webkit-transform: translateY(0);
  36. transform: translateY(0);
  37. }
  38. 40% {
  39. -webkit-transform: translateY(-30px);
  40. transform: translateY(-30px);
  41. }
  42. 60% {
  43. -webkit-transform: translateY(-15px);
  44. transform: translateY(-15px);
  45. }
  46. }
  47.  
  48. </style>
  49.  
  50. <img src="https://scripted.neocities.org/image.jpg" alt="Bounce Infinite Animation" class="img-infinitebouncehover">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement