提交修改

new-v20240713
dshclm 8 months ago
parent 7545137dcd
commit f34f7d0ce0

@ -559,21 +559,22 @@
var noticeInner = document.querySelector('.notice__inner'); var noticeInner = document.querySelector('.notice__inner');
var noticeItems = Array.from(document.querySelectorAll('.notice__item')); var noticeItems = Array.from(document.querySelectorAll('.notice__item'));
var currentIndex = 0; var currentIndex = 0;
function showCurrentNotice() { if (noticeItems.length > 1) {
var numToShow = Math.min(currentIndex + 1, noticeItems.length); function showCurrentNotice() {
for (var i = 0; i < noticeItems.length; i++) { var numToShow = Math.min(currentIndex + 1, noticeItems.length);
noticeItems[i].style.height = ''; for (var i = 0; i < noticeItems.length; i++) {
} noticeItems[i].style.height = '';
for (var i = 0; i < numToShow; i++) { }
noticeItems[i].style.height = 'auto'; 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;
} }
noticeInner.style.transform = "translateY(" + ((-noticeItems[currentIndex].clientHeight * currentIndex)*1.39) + "px)"; showCurrentNotice();
noticeInner.style.transition = "all 2.5s";
noticeInner.scrollTop = noticeItems[currentIndex].offsetTop;
}
showCurrentNotice();
if (noticeItems.length > 1) {
setInterval(() => { setInterval(() => {
currentIndex = (currentIndex + 1) % noticeItems.length; currentIndex = (currentIndex + 1) % noticeItems.length;
showCurrentNotice(); showCurrentNotice();

Loading…
Cancel
Save