Book_system/app/static/js/announcement-list.js
2025-05-12 19:44:22 +08:00

20 lines
601 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 通知公告列表页面的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);
}
});