banner.ejs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <link rel="stylesheet" href="/stylesheets/banner.css">
  2. <div class="carousel-container">
  3. <button class="btn-prev">❮</button>
  4. <div class="carousel-images">
  5. <div class="item" style="display: flex; flex-direction: row; justify-content: center; align-items: center;">
  6. <img width="50%" src="https://pcoloring.com/thumbs/coloring-page/page/480/5d8898684278e31afd9b6968.jpeg"
  7. alt="<%= translate.cuteCat[lang] %> <%= translate.printableColoringPage[lang]%>">
  8. <div style="padding-right: 60px;">
  9. <h1>
  10. <%= translate.cuteCat[lang] %>
  11. </h1>
  12. <p class="cat-description">
  13. <%= translate.cuteCatDescription[lang] %>
  14. </p>
  15. <a href="/play/5d8898684278e31afd9b6968" class="carousel-play-btn">
  16. <%= translate.play[lang] %>
  17. </a>
  18. </div>
  19. </div>
  20. <div class="item" style="display: flex; flex-direction: row; justify-content: space-evenly; align-items: center;">
  21. <div>
  22. <h1>
  23. <%= translate.daily[lang] %>
  24. </h1>
  25. <div style="font-weight: bold; font-size: 20px; color: #aaa; padding-bottom: 20px;">2025/01/19</div>
  26. <a href="/play/6783978993b021143d362277" class="carousel-play-btn">
  27. <%= translate.play[lang] %>
  28. </a>
  29. </div>
  30. <img width="40%" src="https://pcoloring.com/thumbs/coloring-page/page/480/6783978993b021143d362277.jpeg"
  31. alt="<%= translate.daily[lang] %> <%= translate.printableColoringPage[lang]%>"">
  32. </div>
  33. <div class=" item" style="position: relative; display: inline-block;">
  34. <img width="100%" src="https://pcoloring.com/res/coloring/album_cover/720/661cf6deaae27d6dda120bcc.jpeg"
  35. alt="<%= translate.coloringPageAlbum[lang] %>: <%= translate.cuteKids[lang] %>">
  36. <h3 style="position: absolute; top: 20px; left: 20px; color:#ccc; ">
  37. <%= translate.coloringPageAlbum[lang] %>
  38. </h3>
  39. <h1 style="position: absolute; top: 40px; left: 20px; color:white; ">
  40. <%= translate.cuteKids[lang] %>
  41. </h1>
  42. </div>
  43. <div class="item" style="position: relative; display: inline-block;">
  44. <img width="100%" src="https://pcoloring.com/res/coloring/album_cover/720/670e26713562c348e1b64db0.jpeg"
  45. alt="<%= translate.coloringPageAlbum[lang] %>: <%= translate.animalsHappyTime[lang] %>">
  46. <h3 style="position: absolute; top: 20px; left: 20px; color:#ccc; ">
  47. <%= translate.coloringPageAlbum[lang] %>
  48. </h3>
  49. <h1 style="position: absolute; top: 40px; left: 20px; color:white; ">
  50. <%= translate.animalsHappyTime[lang] %>
  51. </h1>
  52. </div>
  53. </div>
  54. <button class="btn-next">❯</button>
  55. </div>
  56. <script>
  57. document.addEventListener('DOMContentLoaded', function () {
  58. const carouselImages = document.querySelector('.carousel-images');
  59. const items = document.querySelectorAll('.carousel-images .item');
  60. const prevButton = document.querySelector('.btn-prev');
  61. const nextButton = document.querySelector('.btn-next');
  62. let currentIndex = 0;
  63. function showItem(index) {
  64. if (index >= items.length) {
  65. currentIndex = 0;
  66. } else if (index < 0) {
  67. currentIndex = items.length - 1;
  68. } else {
  69. currentIndex = index;
  70. }
  71. const offset = -currentIndex * 100; // 每张图片占100%宽度
  72. carouselImages.style.transform = `translateX(${offset}%)`;
  73. }
  74. prevButton.addEventListener('click', function () {
  75. showItem(currentIndex - 1);
  76. });
  77. nextButton.addEventListener('click', function () {
  78. showItem(currentIndex + 1);
  79. });
  80. });
  81. </script>