asimryu

css-animation css

Nov 7th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.68 KB | None | 0 0
  1. * {
  2.     margin: 0 auto;
  3.     padding: 0;
  4.     list-style: none;
  5.     box-sizing: border-box;
  6. }
  7.  
  8. #visual {
  9.     width: 100%;
  10.     height: 600px;
  11.     float: left;
  12.     position: relative;
  13.     overflow: hidden;
  14. }
  15.  
  16. @keyframes slide {
  17.     0% { margin-left:0; }
  18.     20% { margin-left:0; }
  19.     25% { margin-left:-100%; }
  20.     45% { margin-left:-100%; }
  21.     50% { margin-left:-200%; }
  22.     70% { margin-left:-200%; }
  23.     75% { margin-left:-300%; }
  24.     95% { margin-left:-300%; }
  25.     100% { margin-left:0; }
  26. }
  27.  
  28. .imgslide {
  29.     width: 400%;
  30.     height: 600px;
  31.     float: left;
  32.     position: relative;
  33.     transition: all 0.5s;
  34. }
  35.  
  36.  
  37.  
  38. .imgslide li {
  39.     width: 25%;
  40.     height: 600px;
  41.     float: left;
  42.     background-size: cover;
  43.     background-position: center;
  44. }
  45.  
  46. .imgslide li:nth-child(1) {
  47.     background-image: url("../../images/1.jpg");
  48. }
  49.  
  50. .imgslide li:nth-child(2) {
  51.     background-image: url("../../images/2.jpg");
  52. }
  53.  
  54. .imgslide li:nth-child(3) {
  55.     background-image: url("../../images/3.jpg");
  56. }
  57.  
  58. .imgslide li:nth-child(4) {
  59.     background-image: url("../../images/4.jpg");
  60. }
  61.  
  62. .btns {
  63.     width: 50px;
  64.     height: 50px;
  65.     border-radius: 50%;
  66.     background-color: #FFF;
  67.     color: #000;
  68.     text-align: center;
  69.     line-height: 50px;
  70.     position: absolute;
  71.     top: 50%;
  72.     transform: translateY(-50%);
  73.     display: block;
  74.     z-index: 999;
  75. }
  76.  
  77. .btns-left {
  78.     left: 10px;
  79. }
  80. .btns-left::before {
  81.     content: "<";
  82. }
  83. .btns-right {
  84.     right: 10px;
  85. }
  86. .btns-right::before {
  87.     content: ">";
  88. }
  89.  
  90. .btns-right:focus + .imgslide {
  91.     animation: 2s slide1 forwards;
  92. }
  93.  
  94. label{
  95.     width: 10px;
  96.     height: 10px;
  97.     background-color: #000
  98. }
  99.  
  100. #s1:checked ~ .imgslide{left: 0}
  101. #s2:checked ~ .imgslide{left: -100%}
  102. #s3:checked ~ .imgslide{left: -200%}
  103. #s4:checked ~ .imgslide{left: -300%}
Add Comment
Please, Sign In to add comment