diff options
| author | Eltrac Koalar <hi@guhub.cn> | 2022-09-25 16:52:34 +0800 |
|---|---|---|
| committer | Eltrac Koalar <hi@guhub.cn> | 2022-09-25 16:52:34 +0800 |
| commit | 265026c00951bb45783d9169ae3b7ecba10a41ef (patch) | |
| tree | 937469ee868c254de78f1dc63c197e7f7be0ed85 | |
| parent | a138bbffdd655ae5def46c513c9930ad2e26d33e (diff) | |
:airplane: Perf: 缩小文章内懒加载占位符的高度
| -rw-r--r-- | assets/matcha/matcha.js | 3 | ||||
| -rw-r--r-- | assets/matcha/matcha.libs.css | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/assets/matcha/matcha.js b/assets/matcha/matcha.js index 86d6516..54aed5d 100644 --- a/assets/matcha/matcha.js +++ b/assets/matcha/matcha.js @@ -79,7 +79,8 @@ lazyloader = function(){ onError: function(element) { console.log('error loading ' + element.data('src')); }, - afterLoad: function() { + afterLoad: function(el) { + $(el).addClass('lazy-loaded'); //完成后加载 Fluidbox $('.fluidbox-anchor').fluidbox().on('openstart.fluidbox', function(){ $(this).parent().css('overflow', 'visible'); diff --git a/assets/matcha/matcha.libs.css b/assets/matcha/matcha.libs.css index 652c310..19884cc 100644 --- a/assets/matcha/matcha.libs.css +++ b/assets/matcha/matcha.libs.css @@ -214,3 +214,9 @@ div.code-toolbar>.toolbar>.toolbar-item>button::before { border-color: var(--theme-color); color: #fff } + +/* 懒加载 */ + +.post-content img.lazy:not(lazy-loaded) { + max-width: 100px +}
\ No newline at end of file |
