Skip to content

Commit a4a6b73

Browse files
committed
fix: enable continuous scroll tip
1 parent 650f178 commit a4a6b73

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

epub_browser/assets/annotation.css

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,8 @@
553553
content: 'Drag to reorder.';
554554
}
555555

556-
.continuous-scroll-tip:hover::after {
557-
content: attr(data-tip);
558-
position: absolute;
559-
bottom: calc(100% + 8px);
560-
left: 50%;
561-
transform: translateX(-50%);
556+
.continuous-scroll-tooltip {
557+
position: fixed;
562558
background: var(--text);
563559
color: var(--background);
564560
padding: 8px 12px;
@@ -572,17 +568,17 @@
572568
text-align: left;
573569
z-index: 9999;
574570
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
571+
pointer-events: none;
575572
}
576573

577-
.continuous-scroll-tip:hover::before {
574+
.continuous-scroll-tooltip::after {
578575
content: '';
579576
position: absolute;
580-
bottom: calc(100% + 2px);
577+
top: 100%;
581578
left: 50%;
582579
transform: translateX(-50%);
583580
border: 5px solid transparent;
584581
border-top-color: var(--text);
585-
z-index: 9999;
586582
}
587583

588584
.color-add-btn {

epub_browser/assets/chapter.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,6 +1936,31 @@ function initScript() {
19361936
setTimeout(function() { location.reload(); }, 500);
19371937
});
19381938
}
1939+
1940+
// 连续滚动开关的 hint tooltip(JS 动态创建,避免被 settings-content 的 overflow 裁剪)
1941+
if (continuousScrollTip) {
1942+
var tipTooltip = null;
1943+
continuousScrollTip.addEventListener('mouseenter', function() {
1944+
var tipText = continuousScrollTip.getAttribute('data-tip');
1945+
if (!tipText) return;
1946+
1947+
tipTooltip = document.createElement('div');
1948+
tipTooltip.className = 'continuous-scroll-tooltip';
1949+
tipTooltip.textContent = tipText;
1950+
document.body.appendChild(tipTooltip);
1951+
1952+
var iconRect = continuousScrollTip.getBoundingClientRect();
1953+
tipTooltip.style.left = (iconRect.left + iconRect.width / 2) + 'px';
1954+
tipTooltip.style.transform = 'translateX(-50%)';
1955+
tipTooltip.style.bottom = (window.innerHeight - iconRect.top + 8) + 'px';
1956+
});
1957+
continuousScrollTip.addEventListener('mouseleave', function() {
1958+
if (tipTooltip) {
1959+
tipTooltip.remove();
1960+
tipTooltip = null;
1961+
}
1962+
});
1963+
}
19391964
}
19401965

19411966
window.initScriptChapter = initScript;

0 commit comments

Comments
 (0)