20 lines
		
	
	
		
			601 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			601 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// 通知公告列表页面的Javascript
 | 
						||
document.addEventListener('DOMContentLoaded', function() {
 | 
						||
    // 平滑滚动到页面锚点
 | 
						||
    const scrollToAnchor = (anchorId) => {
 | 
						||
        const element = document.getElementById(anchorId);
 | 
						||
        if (element) {
 | 
						||
            element.scrollIntoView({
 | 
						||
                behavior: 'smooth',
 | 
						||
                block: 'start'
 | 
						||
            });
 | 
						||
        }
 | 
						||
    };
 | 
						||
 | 
						||
    // 如果URL中有锚点,执行滚动
 | 
						||
    if (window.location.hash) {
 | 
						||
        const anchorId = window.location.hash.substring(1);
 | 
						||
        setTimeout(() => scrollToAnchor(anchorId), 300);
 | 
						||
    }
 | 
						||
});
 |