优化加载卡顿问题,最稳定版本

This commit is contained in:
Vaica committed 2026-06-02 16:26:38 +08:00
1 parent fadefdc0a1
commit 8c1ee075e8
3 files changed
+71 -111

No files matched your search

+3 -2
View File
@@ -28,10 +28,11 @@
function initPostScrollspy() {
var content = document.getElementById('post-writing');
if (!content) return;
content.querySelectorAll('h2, h3, h4, p, ul, ol, blockquote, table').forEach(function(el) {
// 只给关键元素加动画,减少 observer 数量
content.querySelectorAll('h2, h3, blockquote, table, figure').forEach(function(el) {
if (!el.hasAttribute('uk-scrollspy')) el.setAttribute('uk-scrollspy', 'cls: uk-animation-fade; delay: 60');
});
content.querySelectorAll('figure, img, .post-video, .link-card').forEach(function(el) {
content.querySelectorAll('.post-video, .link-card').forEach(function(el) {
if (!el.hasAttribute('uk-scrollspy')) el.setAttribute('uk-scrollspy', 'cls: uk-animation-slide-bottom-small; delay: 100');
});
}