// 分类筛选功能 document.addEventListener('DOMContentLoaded', function() { const filterTags = document.querySelectorAll('.filter-tag'); filterTags.forEach(tag => { tag.addEventListener('click', function() { // 移除同级元素的active类 const siblings = Array.from(this.parentElement.children); siblings.forEach(sibling => sibling.classList.remove('active')); // 添加active类到当前标签 this.classList.add('active'); // 这里可以添加AJAX请求来筛选内容 // 实际实现中会根据筛选条件加载不同的资讯列表 console.log('筛选条件: ' + this.textContent); }); }); });