banner.ejs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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;">
  26. <%= today%>
  27. </div>
  28. <a href="/play/6783978993b021143d362277" class="carousel-play-btn">
  29. <%= translate.play[lang] %>
  30. </a>
  31. </div>
  32. <img width="40%" src="<%=daily.artInfo.thumb%>"
  33. alt="<%= translate.daily[lang] %> <%= translate.printableColoringPage[lang]%>"">
  34. </div>
  35. <div class=" item" style="position: relative; display: inline-block;">
  36. <img width="100%" src="https://pcoloring.com/res/coloring/album_cover/720/661cf6deaae27d6dda120bcc.jpeg"
  37. alt="<%= translate.coloringPageAlbum[lang] %>: <%= translate.cuteKids[lang] %>">
  38. <h3 style="position: absolute; top: 20px; left: 20px; color:#ccc; ">
  39. <%= translate.coloringPageAlbum[lang] %>
  40. </h3>
  41. <h1 style="position: absolute; top: 40px; left: 20px; color:white; ">
  42. <%= translate.cuteKids[lang] %>
  43. </h1>
  44. </div>
  45. <div class="item" style="position: relative; display: inline-block;">
  46. <img width="100%" src="https://pcoloring.com/res/coloring/album_cover/720/670e26713562c348e1b64db0.jpeg"
  47. alt="<%= translate.coloringPageAlbum[lang] %>: <%= translate.animalsHappyTime[lang] %>">
  48. <h3 style="position: absolute; top: 20px; left: 20px; color:#ccc; ">
  49. <%= translate.coloringPageAlbum[lang] %>
  50. </h3>
  51. <h1 style="position: absolute; top: 40px; left: 20px; color:white; ">
  52. <%= translate.animalsHappyTime[lang] %>
  53. </h1>
  54. </div>
  55. </div>
  56. <button class="btn-next">❯</button>
  57. </div>
  58. <script>
  59. document.addEventListener('DOMContentLoaded', function () {
  60. const carouselImages = document.querySelector('.carousel-images');
  61. const items = document.querySelectorAll('.carousel-images .item');
  62. const prevButton = document.querySelector('.btn-prev');
  63. const nextButton = document.querySelector('.btn-next');
  64. let currentIndex = 0;
  65. function showItem(index) {
  66. if (index >= items.length) {
  67. currentIndex = 0;
  68. } else if (index < 0) {
  69. currentIndex = items.length - 1;
  70. } else {
  71. currentIndex = index;
  72. }
  73. const offset = -currentIndex * 100; // 每张图片占100%宽度
  74. carouselImages.style.transform = `translateX(${offset}%)`;
  75. }
  76. prevButton.addEventListener('click', function () {
  77. showItem(currentIndex - 1);
  78. });
  79. nextButton.addEventListener('click', function () {
  80. showItem(currentIndex + 1);
  81. });
  82. });
  83. </script>