Compare commits

...

3 Commits

Author SHA1 Message Date
DelLevin-Home
bd46afc3d6 优化博客文章接口 2026-05-19 00:21:01 +08:00
DelLevin-Home
e6ba5eb3fb Merge branch 'master' of https://github.com/dellevin/iletter-homepage 2026-05-18 22:35:02 +08:00
MR.ZHANG
8d19e63ceb Create README.md 2026-05-18 22:21:32 +08:00
3 changed files with 28 additions and 13 deletions

View File

@@ -65,4 +65,3 @@
## 许可证
本项目仅供学习交流使用。

View File

@@ -744,6 +744,7 @@
flex-direction: column;
gap: 8px;
padding: 15px 20px;
margin-bottom: 60px;
}
.guestbook-item {

View File

@@ -40,8 +40,11 @@
}
}
// 处理滚动事件
// 处理滚动事件(仅针对预览面板)
function handleScroll(e) {
// 如果滚动的是全屏弹窗,则不触发自动加载
if (e.target.closest('#blog-posts-full-modal')) return;
const { scrollTop, scrollHeight, clientHeight } = e.target;
// 距离底部 50px 时触发加载
if (scrollHeight - scrollTop - clientHeight < 50) {
@@ -140,6 +143,7 @@
}
fullHtml = containerHtml;
// 弹窗界面保留“点击加载更多”按钮
if (hasMore) {
fullHtml += `<button class="load-more-btn" onclick="window.loadMoreBlogPosts()">点击加载更多</button>`;
} else {
@@ -188,18 +192,29 @@
toRemove.remove();
}
// 在当前容器后添加新的加载更多按钮或提示
if (hasMore) {
const btn = document.createElement('button');
btn.className = 'load-more-btn';
btn.textContent = '点击加载更多';
btn.onclick = window.loadMoreBlogPosts;
container.after(btn);
// 区分预览面板和全屏弹窗:预览面板不显示按钮,全屏弹窗显示按钮
const isPreview = container.closest('#blog-posts-preview');
if (!isPreview) {
if (hasMore) {
const btn = document.createElement('button');
btn.className = 'load-more-btn';
btn.textContent = '点击加载更多';
btn.onclick = window.loadMoreBlogPosts;
container.after(btn);
} else {
const tip = document.createElement('div');
tip.className = 'load-complete';
tip.textContent = '已显示全部';
container.after(tip);
}
} else {
const tip = document.createElement('div');
tip.className = 'load-complete';
tip.textContent = '已显示全部';
container.after(tip);
// 预览面板仅显示完成提示
if (!hasMore) {
const tip = document.createElement('div');
tip.className = 'load-complete';
tip.textContent = '已显示全部';
container.after(tip);
}
}
});