1.淡入淡出轮播图.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. list-style: none;
  12. text-decoration: none;
  13. box-sizing: border-box;
  14. }
  15. #container {
  16. width: 590px;
  17. height: 470px;
  18. margin: 100px auto;
  19. position: relative;
  20. }
  21. #imgBox img{
  22. /* opacity 透明度
  23. 占位
  24. 点击事件仍会触发
  25. */
  26. opacity: 0;
  27. transition: opacity 1s linear;
  28. position: absolute;
  29. }
  30. #imgBox .active {
  31. opacity: 1;
  32. }
  33. .list {
  34. overflow: hidden;
  35. position: absolute;
  36. bottom: 10px;
  37. right: 10px;
  38. }
  39. .list li {
  40. float: left;
  41. width: 20px;
  42. height: 20px;
  43. background: #00f;
  44. color: #fff;
  45. font-size: 14px;
  46. text-align: center;
  47. line-height: 20px;
  48. border-radius: 50%;
  49. margin-right: 10px;
  50. }
  51. .list .selected {
  52. background: #ff0;
  53. color: #f00;
  54. }
  55. </style>
  56. </head>
  57. <body>
  58. <div id="container">
  59. <div id="imgBox">
  60. <img class="active" src="../image/1.jpg" alt="">
  61. <img src="../image/2.jpg" alt="">
  62. <img src="../image/3.jpg" alt="">
  63. <img src="../image/4.jpg" alt="">
  64. <img src="../image/5.jpg" alt="">
  65. </div>
  66. <ul class="list">
  67. <li class="selected">1</li>
  68. <li>2</li>
  69. <li>3</li>
  70. <li>4</li>
  71. <li>5</li>
  72. </ul>
  73. </div>
  74. <script src="../js/1.淡入淡出轮播图.js"></script>
  75. </body>
  76. </html>