Udoro

CSS slider - 3-slides

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