头条
道外区精彩资讯
关注道外区经济社会发展最新动态
2026-01-10
头条
道外区精彩资讯
关注道外区经济社会发展最新动态
2026-01-10
头条
道外区精彩资讯
关注道外区经济社会发展最新动态
2026-01-10
var slides = document.querySelectorAll('.carousel-slide');
var dots = document.querySelectorAll('.carousel-dot');
var current = 0;
var total = slides.length;
var timer = null;
function show(idx) {
slides.forEach(function(s){ s.classList.remove('active'); });
dots.forEach(function(d){ d.classList.remove('active'); });
current = ((idx % total) + total) % total;
slides[current].classList.add('active');
if(dots[current]) dots[current].classList.add('active');
}
window.carouselNext = function(){ show(current + 1); resetTimer(); };
window.carouselPrev = function(){ show(current - 1); resetTimer(); };
dots.forEach(function(dot, i){
dot.addEventListener('click', function(){ show(i); resetTimer(); });
});
function autoPlay(){ show(current + 1); }
function resetTimer(){ if(timer) clearInterval(timer); timer = setInterval(autoPlay, 5000); }
if(total > 1) resetTimer();
})();
// 频道导航滚动高亮
(function(){
var tabs = document.querySelectorAll('.ch-tab');
var nav = document.getElementById('channelNav');
if(!nav) return;
tabs.forEach(function(tab){
tab.addEventListener('click', function(e){
tabs.forEach(function(t){ t.classList.remove('active'); });
this.classList.add('active');
});
});
})();
// 新闻滚动暂停
(function(){
var ticker = document.querySelector('.ticker-scroll');
if(!ticker) return;
ticker.addEventListener('mouseenter', function(){ this.style.animationPlayState = 'paused'; });
ticker.addEventListener('mouseleave', function(){ this.style.animationPlayState = 'running'; });
})();