Skip to content

Commit feca676

Browse files
committed
修复 Firefox 中翻转卡片按钮的可见性问题
1 parent 8231272 commit feca676

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

client/css/body.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ body {
6363
z-index: 10;
6464
}
6565

66+
/* Firefox兼容性修复:控制翻转时按钮的可见性 */
67+
.flip-card-inner.flipped .flip-card-front .help-btn {
68+
visibility: hidden;
69+
opacity: 0;
70+
pointer-events: none;
71+
}
72+
73+
.flip-card-inner:not(.flipped) .flip-card-back .help-btn {
74+
visibility: hidden;
75+
opacity: 0;
76+
pointer-events: none;
77+
}
78+
6679
.help-btn:hover {
6780
background: #30a8f7;
6881
border-color: #30a8f7;

client/js/ui.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,19 @@ export function initFlipCard() {
598598

599599
// 当前旋转角度 / Current rotation angle
600600
let currentRotation = 0;
601-
602-
// 执行翻转操作 / Execute flip operation
601+
// 执行翻转操作 / Execute flip operation
603602
function performFlip() {
604603
currentRotation += 180;
605604
const flipCardInner = flipCard.querySelector('.flip-card-inner');
606605
if (flipCardInner) {
607606
flipCardInner.style.transform = `rotateX(${currentRotation}deg)`;
607+
608+
// 添加或移除flipped类来控制按钮可见性(Firefox兼容性修复)
609+
if (currentRotation % 360 === 180 || currentRotation % 360 === -180) {
610+
flipCardInner.classList.add('flipped');
611+
} else {
612+
flipCardInner.classList.remove('flipped');
613+
}
608614
}
609615
}
610616

0 commit comments

Comments
 (0)