Advertisement
_martin

css slideshow

Nov 15th, 2014
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 5.98 KB | None | 0 0
  1. * {
  2.   margin: 0;
  3.   padding: 0;
  4. }
  5.  
  6. .wrap {
  7.   padding: 10px 70px 30px;
  8.   width: 400px;
  9.   position: relative;
  10.   height: 200px;
  11.   text-align: center;
  12. }
  13.  
  14. .slide {
  15.   width: 400px;
  16.   height: 200px;
  17.   position: relative;
  18.   border: 1px solid #ccc;
  19. }
  20. .slide li {
  21.   list-style: none;
  22.   position: absolute;
  23.   left: 0;
  24.   top: 35px;
  25.   display: inline-block;
  26.   width: 100%;
  27.   height: 100%;
  28.   opacity: 0;
  29.   font: 100px arial helvetica, sans-serif;
  30. }
  31.  
  32. input,
  33. .label {
  34.   position: relative;
  35.   top: 235px;
  36.   cursor: pointer;
  37. }
  38.  
  39. input {
  40.   z-index: 2;
  41.   width: 20px;
  42.   height: 20px;
  43.   opacity: 0;
  44. }
  45.  
  46. .label {
  47.   z-index: 1;
  48.   width: 20px;
  49.   height: 20px;
  50.   background-color: #ccc;
  51.   display: inline-block;
  52. }
  53. .label:first-of-type {
  54.   margin-left: -95px;
  55. }
  56.  
  57. .next,
  58. .prev {
  59.   position: absolute;
  60.   top: 110px;
  61.   width: 70px !important;
  62.   font-size: 0;
  63.   cursor: pointer;
  64.   color: #555;
  65. }
  66. .next:active,
  67. .prev:active {
  68.   font-size: 30px;
  69. }
  70.  
  71. .prev {
  72.   left: 15px;
  73. }
  74.  
  75. .next {
  76.   right: 15px;
  77. }
  78.  
  79. @keyframes toggle-slide {
  80.   2.5%,
  81. 22.5% {
  82.     opacity: 1;
  83.   }
  84.   25%,
  85. 100% {
  86.     opacity: 0;
  87.   }
  88. }
  89. @keyframes toggle-ctrl {
  90.   2.5%,
  91. 22.5% {
  92.     background-color: #555;
  93.   }
  94.   25%,
  95. 100% {
  96.     background-color: #ccc;
  97.   }
  98. }
  99. @keyframes toggle-arrow {
  100.   0%,
  101. 24.9975% {
  102.     font-size: 30px;
  103.   }
  104.   25%,
  105. 100% {
  106.     font-size: 0;
  107.   }
  108. }
  109. input:active ~ .slide li,
  110. input:active ~ .label,
  111. input:active ~ .prev,
  112. input:active ~ .next {
  113.   animation: none !important;
  114. }
  115.  
  116. .slide li {
  117.   animation: toggle-slide 12s infinite;
  118. }
  119.  
  120. .label {
  121.   animation: toggle-ctrl 12s infinite;
  122. }
  123.  
  124. .prev,
  125. .next {
  126.   animation: toggle-arrow 12s infinite;
  127. }
  128.  
  129. input:nth-of-type(1):checked ~ .slide li:nth-child(1),
  130. input:nth-of-type(1):checked ~ .label:nth-of-type(1) {
  131.   animation-delay: 0s;
  132. }
  133. input:nth-of-type(1):checked ~ .prev:nth-of-type(8),
  134. input:nth-of-type(1):checked ~ .next:nth-of-type(10) {
  135.   animation-delay: 0s;
  136. }
  137. input:nth-of-type(1):checked ~ .slide li:nth-child(2),
  138. input:nth-of-type(1):checked ~ .label:nth-of-type(2) {
  139.   animation-delay: 3s;
  140. }
  141. input:nth-of-type(1):checked ~ .prev:nth-of-type(5),
  142. input:nth-of-type(1):checked ~ .next:nth-of-type(11) {
  143.   animation-delay: 3s;
  144. }
  145. input:nth-of-type(1):checked ~ .slide li:nth-child(3),
  146. input:nth-of-type(1):checked ~ .label:nth-of-type(3) {
  147.   animation-delay: 6s;
  148. }
  149. input:nth-of-type(1):checked ~ .prev:nth-of-type(6),
  150. input:nth-of-type(1):checked ~ .next:nth-of-type(12) {
  151.   animation-delay: 6s;
  152. }
  153. input:nth-of-type(1):checked ~ .slide li:nth-child(4),
  154. input:nth-of-type(1):checked ~ .label:nth-of-type(4) {
  155.   animation-delay: 9s;
  156. }
  157. input:nth-of-type(1):checked ~ .prev:nth-of-type(7),
  158. input:nth-of-type(1):checked ~ .next:nth-of-type(9) {
  159.   animation-delay: 9s;
  160. }
  161.  
  162. input:nth-of-type(2):checked ~ .slide li:nth-child(1),
  163. input:nth-of-type(2):checked ~ .label:nth-of-type(1) {
  164.   animation-delay: 9s;
  165. }
  166. input:nth-of-type(2):checked ~ .prev:nth-of-type(8),
  167. input:nth-of-type(2):checked ~ .next:nth-of-type(10) {
  168.   animation-delay: 9s;
  169. }
  170. input:nth-of-type(2):checked ~ .slide li:nth-child(2),
  171. input:nth-of-type(2):checked ~ .label:nth-of-type(2) {
  172.   animation-delay: 0s;
  173. }
  174. input:nth-of-type(2):checked ~ .prev:nth-of-type(5),
  175. input:nth-of-type(2):checked ~ .next:nth-of-type(11) {
  176.   animation-delay: 0s;
  177. }
  178. input:nth-of-type(2):checked ~ .slide li:nth-child(3),
  179. input:nth-of-type(2):checked ~ .label:nth-of-type(3) {
  180.   animation-delay: 3s;
  181. }
  182. input:nth-of-type(2):checked ~ .prev:nth-of-type(6),
  183. input:nth-of-type(2):checked ~ .next:nth-of-type(12) {
  184.   animation-delay: 3s;
  185. }
  186. input:nth-of-type(2):checked ~ .slide li:nth-child(4),
  187. input:nth-of-type(2):checked ~ .label:nth-of-type(4) {
  188.   animation-delay: 6s;
  189. }
  190. input:nth-of-type(2):checked ~ .prev:nth-of-type(7),
  191. input:nth-of-type(2):checked ~ .next:nth-of-type(9) {
  192.   animation-delay: 6s;
  193. }
  194.  
  195. input:nth-of-type(3):checked ~ .slide li:nth-child(1),
  196. input:nth-of-type(3):checked ~ .label:nth-of-type(1) {
  197.   animation-delay: 6s;
  198. }
  199. input:nth-of-type(3):checked ~ .prev:nth-of-type(8),
  200. input:nth-of-type(3):checked ~ .next:nth-of-type(10) {
  201.   animation-delay: 6s;
  202. }
  203. input:nth-of-type(3):checked ~ .slide li:nth-child(2),
  204. input:nth-of-type(3):checked ~ .label:nth-of-type(2) {
  205.   animation-delay: 9s;
  206. }
  207. input:nth-of-type(3):checked ~ .prev:nth-of-type(5),
  208. input:nth-of-type(3):checked ~ .next:nth-of-type(11) {
  209.   animation-delay: 9s;
  210. }
  211. input:nth-of-type(3):checked ~ .slide li:nth-child(3),
  212. input:nth-of-type(3):checked ~ .label:nth-of-type(3) {
  213.   animation-delay: 0s;
  214. }
  215. input:nth-of-type(3):checked ~ .prev:nth-of-type(6),
  216. input:nth-of-type(3):checked ~ .next:nth-of-type(12) {
  217.   animation-delay: 0s;
  218. }
  219. input:nth-of-type(3):checked ~ .slide li:nth-child(4),
  220. input:nth-of-type(3):checked ~ .label:nth-of-type(4) {
  221.   animation-delay: 3s;
  222. }
  223. input:nth-of-type(3):checked ~ .prev:nth-of-type(7),
  224. input:nth-of-type(3):checked ~ .next:nth-of-type(9) {
  225.   animation-delay: 3s;
  226. }
  227.  
  228. input:nth-of-type(4):checked ~ .slide li:nth-child(1),
  229. input:nth-of-type(4):checked ~ .label:nth-of-type(1) {
  230.   animation-delay: 3s;
  231. }
  232. input:nth-of-type(4):checked ~ .prev:nth-of-type(8),
  233. input:nth-of-type(4):checked ~ .next:nth-of-type(10) {
  234.   animation-delay: 3s;
  235. }
  236. input:nth-of-type(4):checked ~ .slide li:nth-child(2),
  237. input:nth-of-type(4):checked ~ .label:nth-of-type(2) {
  238.   animation-delay: 6s;
  239. }
  240. input:nth-of-type(4):checked ~ .prev:nth-of-type(5),
  241. input:nth-of-type(4):checked ~ .next:nth-of-type(11) {
  242.   animation-delay: 6s;
  243. }
  244. input:nth-of-type(4):checked ~ .slide li:nth-child(3),
  245. input:nth-of-type(4):checked ~ .label:nth-of-type(3) {
  246.   animation-delay: 9s;
  247. }
  248. input:nth-of-type(4):checked ~ .prev:nth-of-type(6),
  249. input:nth-of-type(4):checked ~ .next:nth-of-type(12) {
  250.   animation-delay: 9s;
  251. }
  252. input:nth-of-type(4):checked ~ .slide li:nth-child(4),
  253. input:nth-of-type(4):checked ~ .label:nth-of-type(4) {
  254.   animation-delay: 0s;
  255. }
  256. input:nth-of-type(4):checked ~ .prev:nth-of-type(7),
  257. input:nth-of-type(4):checked ~ .next:nth-of-type(9) {
  258.   animation-delay: 0s;
  259. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement