From 7545137dcdfd4c53a0899f9347f7f61c0d017d0c Mon Sep 17 00:00:00 2001 From: dshclm <3321914460@qq.com> Date: Wed, 31 Jul 2024 10:22:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/css/base.css | 80 ------------------- .../main/resources/templates/home/base.html | 32 +++++++- 2 files changed, 28 insertions(+), 84 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/css/base.css b/ruoyi-admin/src/main/resources/static/css/base.css index dcb379a..11aaa6e 100644 --- a/ruoyi-admin/src/main/resources/static/css/base.css +++ b/ruoyi-admin/src/main/resources/static/css/base.css @@ -431,86 +431,6 @@ a:hover{ padding: 0 12px; margin-bottom: 15px; } -@keyframes roll { - 0% { - margin-top: 0; - } - 4% { - margin-top: 0; - } - 8% { - margin-top: 0; - } - 12% { - margin-top: -55px; - } - 16% { - margin-top: -55px; - } - 20% { - margin-top: -110px; - } - 24% { - margin-top: -110px; - } - 28% { - margin-top: -165px; - } - 32% { - margin-top: -165px; - } - 36% { - margin-top: -220px; - } - 40% { - margin-top: -220px; - } - 44% { - margin-top: -275px; - } - 48% { - margin-top: -275px; - } - 52% { - margin-top: -330px; - } - 56% { - margin-top: -330px; - } - 60% { - margin-top: -275px; - } - 64% { - margin-top: -275px; - } - 68% { - margin-top: -220px; - } - 72% { - margin-top: -220px; - } - 76% { - margin-top: -165px; - } - 80% { - margin-top: -165px; - } - 84% { - margin-top: -110px; - } - 88% { - margin-top: -110px; - } - 92% { - margin-top: -55px; - } - 96% { - margin-top: -55px; - } - 100% { - margin-top: 0; - } -} .xuanchuanImage { diff --git a/ruoyi-admin/src/main/resources/templates/home/base.html b/ruoyi-admin/src/main/resources/templates/home/base.html index d947b9f..8d342b6 100644 --- a/ruoyi-admin/src/main/resources/templates/home/base.html +++ b/ruoyi-admin/src/main/resources/templates/home/base.html @@ -145,7 +145,7 @@ <a href="work_view.html" target="_blank">更多+</a> </span> </div> - <div class="layui-card-body" style="max-height: 400px;overflow: hidden;"> + <div class="layui-card-body" style="min-height: 400px;overflow: hidden;"> <div th:if="${!workList.isEmpty()}" style="width:100%;height: 165px;display: flex;justify-content: space-between;"> <div style="height: 100%;width: 47%;filter: brightness(1.1);"> <a th:href="@{/public_view.html(type=2,id=${workList[0].workId})}" th:title="${workList[0].workTitle}" target="_blank"> @@ -236,7 +236,7 @@ <a href="business_view.html" target="_blank">更多+</a> </span> </div> - <div class="layui-card-body" style="max-height: 400px;overflow: hidden;"> + <div class="layui-card-body" style="min-height: 400px;overflow: hidden;"> <ul class="newslist-to"> <li style="list-style: none" th:each="business,status : ${businessList}" th:if="${!status.first}" th:class="${status.count == 1 ? 'firstLi' : (status.count == 2 ? 'secondLi' : (status.count == 3 ? 'thirdLi' : ''))}"> <span @@ -395,7 +395,7 @@ }) }); </script> -<script type="text/javascript"> +<script type="text/javascript" th:inline="javascript"> window.addEventListener('DOMContentLoaded', function () { var currentUrl = location.href; // 获取所有的<a>标签 @@ -408,7 +408,6 @@ } } }); - layui.use(function () { var carousel = layui.carousel; // 渲染 - 图片轮播 @@ -556,6 +555,31 @@ isMouseOver = true; el.style.display = 'none' } + document.addEventListener('DOMContentLoaded', function() { + var noticeInner = document.querySelector('.notice__inner'); + var noticeItems = Array.from(document.querySelectorAll('.notice__item')); + var currentIndex = 0; + function showCurrentNotice() { + var numToShow = Math.min(currentIndex + 1, noticeItems.length); + for (var i = 0; i < noticeItems.length; i++) { + noticeItems[i].style.height = ''; + } + for (var i = 0; i < numToShow; i++) { + noticeItems[i].style.height = 'auto'; + } + noticeInner.style.transform = "translateY(" + ((-noticeItems[currentIndex].clientHeight * currentIndex)*1.39) + "px)"; + noticeInner.style.transition = "all 2.5s"; + noticeInner.scrollTop = noticeItems[currentIndex].offsetTop; + + } + showCurrentNotice(); + if (noticeItems.length > 1) { + setInterval(() => { + currentIndex = (currentIndex + 1) % noticeItems.length; + showCurrentNotice(); + }, 2500); + } + }); </script> </body> </html>