fix: hero 字母不可见 (渐变不继承) + 升级 text.splitText API
- .hero-letter 加自己的渐变 + -webkit-background-clip:text 原因: 父 h1 的 -webkit-text-fill-color:transparent 继承到 span 但 background 不继承,span 变成 box 就切断 background-clip:text 的连贯, span 里文字就全透明看不见 - text.split(...) → text.splitText(...) 修掉 v4.3 的 deprecation warning Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
index.html
13
index.html
@@ -266,8 +266,13 @@
|
|||||||
will-change:transform;
|
will-change:transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hero animated logo */
|
/* hero animated logo —— 每个字母自带渐变剪影(父级 -webkit-text-fill-color:transparent 不继承背景,这里补回) */
|
||||||
h1 .hero-letter{display:inline-block;will-change:transform,opacity,color}
|
h1 .hero-letter{
|
||||||
|
display:inline-block;will-change:transform,opacity,color;
|
||||||
|
background:linear-gradient(135deg,var(--accent) 0%,var(--accent3) 55%,var(--accent2) 100%);
|
||||||
|
-webkit-background-clip:text;background-clip:text;
|
||||||
|
-webkit-text-fill-color:transparent;
|
||||||
|
}
|
||||||
|
|
||||||
/* online badge */
|
/* online badge */
|
||||||
.live-badge{
|
.live-badge{
|
||||||
@@ -1591,8 +1596,8 @@ stickys.<span class="fn">forEach</span>(s => s.<span class="fn">revert</span>
|
|||||||
let splitInstance = null;
|
let splitInstance = null;
|
||||||
function ensureSplit() {
|
function ensureSplit() {
|
||||||
if (splitInstance) splitInstance.revert && splitInstance.revert();
|
if (splitInstance) splitInstance.revert && splitInstance.revert();
|
||||||
if (text && text.split) {
|
if (text && text.splitText) {
|
||||||
splitInstance = text.split(textTarget, { chars: { class: 'letter' } });
|
splitInstance = text.splitText(textTarget, { chars: { class: 'letter' } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function textDemo(kind) {
|
function textDemo(kind) {
|
||||||
|
|||||||
Reference in New Issue
Block a user