Skip to content

Commit

Permalink
[feature] img lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
AIboy996 committed Aug 2, 2024
1 parent d867971 commit dcfea2c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/assets/javascripts/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ function link_blank() {
document.querySelectorAll(".md-content a[href *='//']:not(.md-content__button):not(:has(img))").forEach(function (link) {
link.setAttribute('target', '_blank');
});
document.querySelectorAll("figure img").forEach(function (img) {
img.setAttribute('loading', 'lazy');
});
};

window.addEventListener("load", link_blank);

0 comments on commit dcfea2c

Please sign in to comment.