diff options
| author | Eltrac <hi@guhub.cn> | 2025-10-30 11:43:05 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-10-30 11:43:05 +0800 |
| commit | 11c2cc7e2c8da0278682d6655edaa5b28854b8cd (patch) | |
| tree | b71f591273198c62d8d6acce17a193cb376b56d4 /layouts/_partials | |
| parent | 0a646e13dc1d65ad7c8c524365248f39cce475d9 (diff) | |
perf: dynamically load libra.js
Diffstat (limited to 'layouts/_partials')
| -rw-r--r-- | layouts/_partials/scripts/libra-js.html | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/layouts/_partials/scripts/libra-js.html b/layouts/_partials/scripts/libra-js.html index 0eea3d07..95e121ed 100644 --- a/layouts/_partials/scripts/libra-js.html +++ b/layouts/_partials/scripts/libra-js.html @@ -1,4 +1,6 @@ <script type="module"> - import LightBox from '/js/libra.min.js'; - const lightbox = new LightBox({ offset: { x: -8 ,y: -80 } }); +document.addEventListener('DOMContentLoaded', async () => { + const { default: LightBox } = await import('/js/libra.min.js'); + const lightbox = new LightBox({ offset: { x: -8, y: -80 } }); +}); </script> |
