Skip to content

Commit 0e93278

Browse files
committed
Revert "feat: update add timeout"
This reverts commit 4c5fa5f.
1 parent 4c5fa5f commit 0e93278

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

epub_browser/assets/chapter.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,8 @@ body {
893893

894894
/* CSS Column 分页样式 - 使用 CSS Column 实现分页 */
895895
.pagination-mode #eb-content {
896+
/* 上面不影响进度条 */
897+
margin-top: 20px !important;
896898
height: 100%;
897899
padding: 0px !important;
898900
margin: 0;

epub_browser/assets/chapter.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,20 @@ function initScript() {
584584
// 保存原始内容
585585
const originalContent = preprocessContent(content);
586586

587+
// 获取容器高度
588+
const bottomNav = document.querySelector('.navigation');
589+
const bottomNavMobile = document.querySelector('.mobile-controls');
590+
const bottomNavHeight = getElementHeight(bottomNav);
591+
const bottomNavMobileHeight = getElementHeight(bottomNavMobile);
592+
593+
const viewportHeight = window.innerHeight;
594+
595+
let contentHeight = viewportHeight - bottomNavHeight - bottomNavMobileHeight - 40; // 减去边距和安全余量,安全余量就是 margin-top: 20px,然后上下不就都是 20 了
596+
contentContainer.style.height = `${viewportHeight - bottomNavHeight - bottomNavMobileHeight}px`;
597+
598+
// 直接设置内容容器的高度
599+
content.style.height = `${contentHeight}px`;
600+
587601
// 先恢复原始内容,以便计算内容高度
588602
content.innerHTML = originalContent;
589603

@@ -617,8 +631,8 @@ function initScript() {
617631
setTimeout(() => {
618632
calculateTotalPages();
619633
pageJumpInput.setAttribute('max', totalPages);
620-
}, 200);
621-
}, 200);
634+
}, 100);
635+
}, 100);
622636
}
623637

624638
// 计算总页数

0 commit comments

Comments
 (0)