mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-05 23:56:37 +08:00
feat: 优化滚动按钮显示逻辑,监听容器高度变化自动切换
This commit is contained in:
@@ -552,14 +552,25 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听窗口滚动事件来显示/隐藏滚动按钮
|
// 监听container高度变化来显示/隐藏滚动按钮
|
||||||
window.addEventListener('scroll', function() {
|
function updateScrollButtons() {
|
||||||
|
const container = document.querySelector('.container');
|
||||||
const scrollButtons = document.querySelector('.scroll-buttons');
|
const scrollButtons = document.querySelector('.scroll-buttons');
|
||||||
if (window.scrollY > 100) {
|
if (container.scrollHeight > container.clientHeight) {
|
||||||
scrollButtons.style.display = 'flex';
|
scrollButtons.style.display = 'flex';
|
||||||
} else {
|
} else {
|
||||||
scrollButtons.style.display = 'none';
|
scrollButtons.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始检查
|
||||||
|
updateScrollButtons();
|
||||||
|
|
||||||
|
// 监听展开/折叠事件
|
||||||
|
document.querySelectorAll('.key-list h2').forEach(header => {
|
||||||
|
header.addEventListener('click', () => {
|
||||||
|
setTimeout(updateScrollButtons, 300); // 等待展开动画完成
|
||||||
|
});
|
||||||
});
|
});
|
||||||
function refreshPage(button) {
|
function refreshPage(button) {
|
||||||
button.classList.add('loading');
|
button.classList.add('loading');
|
||||||
|
|||||||
Reference in New Issue
Block a user