Udoro

CSS slider - 4-slides

Aug 19th, 2021 (edited)
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. .slide1, .slide2, .slide3, .slide3{
  2. will-change:background-position, opacity;
  3. }
  4.  
  5. .mainslider{
  6. position:relative;
  7. height:100vh;
  8. background:white;
  9. }
  10.  
  11.  
  12. .sliderc {
  13. position: absolute;
  14. inset:0;
  15. margin: auto;
  16. }
  17.  
  18.  
  19. .slide1 {
  20. animation-name: slc1;
  21. -webkit-animation-name: slc1;
  22. -moz-animation-name: slc1;
  23. animation-duration: 16s;
  24. -webkit-animation-duration: 16s;
  25. animation-fill-mode: forwards;
  26. animation-timing-function: linear;
  27. animation-iteration-count:infinite;
  28.  
  29. }
  30.  
  31. @keyframes slc1 {
  32. 0% { z-index:10; opacity:1; background-position: 0% 100%;}
  33. 24% { z-index:10; opacity:1;}
  34. 25% { z-index:10; opacity:0; }
  35. 99% { z-index:10; opacity:0; background-position: 100% 0%;}
  36. 100% { z-index:10;opacity:1; }
  37. }
  38.  
  39. .slide2 {
  40. animation-name: slc2;
  41. -webkit-animation-name: slc2;
  42. -moz-animation-name: slc2;
  43. animation-duration: 16s;
  44. -webkit-animation-duration: 16s;
  45. animation-fill-mode: forwards;
  46. animation-timing-function: linear;
  47. animation-iteration-count:infinite;
  48.  
  49. }
  50.  
  51. @keyframes slc2 {
  52. 0% { z-index:9; opacity:0; background-position: 0% 100%;}
  53. 24% { z-index:9; opacity:0;}
  54. 25% { z-index:11; opacity:1; }
  55. 49% { z-index:11; opacity:1; }
  56. 50% { z-index:11; opacity:0; }
  57. 100% { z-index:11; opacity:0; background-position: 100% 0%;}
  58. }
  59.  
  60.  
  61. .slide3{
  62. animation-name: slc3;
  63. -webkit-animation-name: slc3;
  64. -moz-animation-name: slc3;
  65. animation-duration: 16s;
  66. -webkit-animation-duration: 16s;
  67. animation-fill-mode: forwards;
  68. animation-timing-function: linear;
  69. animation-iteration-count:infinite;
  70. }
  71.  
  72. @keyframes slc3 {
  73. 0% { z-index:8; opacity:0; background-position: 0% 100%; }
  74. 49% { z-index:8; opacity:0; }
  75. 50% { z-index:12; opacity:1; }
  76. 74% { z-index:12; opacity:1; }
  77. 75% { z-index:12; opacity:0; }
  78. 100% { z-index:12; opacity:0; background-position: 100% 0%;}
  79. }
  80.  
  81.  
  82. .slide4{
  83. animation-name: slc4;
  84. -webkit-animation-name: slc4;
  85. -moz-animation-name: slc4;
  86. animation-duration: 16s;
  87. -webkit-animation-duration: 16s;
  88. animation-fill-mode: forwards;
  89. animation-timing-function: linear;
  90. animation-iteration-count:infinite;
  91. }
  92.  
  93. @keyframes slc4 {
  94. 0% { z-index:7; opacity:0; background-position: 0% 100%; }
  95. 74% { z-index:7; opacity:0;}
  96. 75% { z-index:13; opacity:1;}
  97. 99% { z-index:13; opacity:1;}
  98. 100% { z-index:13;opacity:0; background-position: 100% 0%;}
  99. }
  100.  
  101.  
Add Comment
Please, Sign In to add comment