Advertisement
afsarwebdev

FadeIn on load Multiple div

Oct 2nd, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. HTML:
  2. <body>
  3.  
  4. <div class="box fade-in one">
  5. 1) look at me fade in
  6. </div>
  7.  
  8. <div class="box fade-in two">
  9. 2) Oh hi! i can fade too!
  10. </div>
  11.  
  12. <div class="box fade-in three">
  13. 3) Oh hi! i can fade three!
  14. </div>
  15.  
  16. </body>
  17.  
  18. CSS:
  19.  
  20. /* make keyframes that tell the start state and the end state of our object */
  21.  
  22. @-webkit-keyframes fadeIn { from { opacity:0; opacity: 1\9; /* IE9 only */ } to { opacity:1; } }
  23. @-moz-keyframes fadeIn { from { opacity:0; opacity: 1\9; /* IE9 only */ } to { opacity:1; } }
  24. @keyframes fadeIn { from { opacity:0; opacity: 1\9; /* IE9 only */ } to { opacity:1; } }
  25.  
  26. .fade-in {
  27. opacity:0; /* make things invisible upon start */
  28. -webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
  29. -moz-animation:fadeIn ease-in 1;
  30. animation:fadeIn ease-in 1;
  31.  
  32. -webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
  33. -moz-animation-fill-mode:forwards;
  34. animation-fill-mode:forwards;
  35.  
  36. -webkit-animation-duration:1s;
  37. -moz-animation-duration:1s;
  38. animation-duration:1s;
  39. }
  40.  
  41. .fade-in.one {
  42. -webkit-animation-delay: 0.7s;
  43. -moz-animation-delay: 0.7s;
  44. animation-delay: 0.7s;
  45. }
  46.  
  47. .fade-in.two {
  48. -webkit-animation-delay: 1.2s;
  49. -moz-animation-delay:1.2s;
  50. animation-delay: 1.2s;
  51. }
  52.  
  53. .fade-in.three {
  54. -webkit-animation-delay: 1.6s;
  55. -moz-animation-delay: 1.6s;
  56. animation-delay: 1.6s;
  57. }
  58.  
  59. /*---make a basic box ---*/
  60. .box{
  61. width: 100px;
  62. height: 100px;
  63. position: relative;
  64. margin: 10px;
  65. color: white;
  66. padding: 40px;
  67. float: left;
  68. border: 1px solid #fff;
  69. background: #27a5d2;
  70. border-radius: 10px;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement