1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Fixed image lazy loading.

This commit is contained in:
Cotes Chung
2020-05-29 04:51:20 +08:00
parent 171faafc67
commit cfb67a1cb9
3 changed files with 13 additions and 6 deletions

View File

@@ -1,7 +1,8 @@
<!-- image lazy load: https://github.com/ApoorvSaxena/lozad.js -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"></script>
<script type="text/javascript">
const el = document.querySelectorAll('#post-wrapper img');
const observer = lozad(el);
const imgs = document.querySelectorAll('#post-wrapper img');
const observer = lozad(imgs);
observer.observe();
</script>