diff options
author | jeffreytse <jeffreytse.mail@gmail.com> | 2021-06-28 18:44:37 +0800 |
---|---|---|
committer | jeffreytse <jeffreytse.mail@gmail.com> | 2021-06-28 18:45:05 +0800 |
commit | 4e3e599bbff99261206cefaa1159e61d7d353262 (patch) | |
tree | 89e415731fc36169d8d535fabd78144f152c0f87 /_includes | |
parent | 735c2ad48be93582457395aa172f9951dadff37e (diff) |
perf: postpone initializing site header
Postpone this step to the stage that DOM loaed, but img and css not
Diffstat (limited to '_includes')
-rw-r--r-- | _includes/views/header.html | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/_includes/views/header.html b/_includes/views/header.html index 169bf01..ba707b0 100644 --- a/_includes/views/header.html +++ b/_includes/views/header.html @@ -56,7 +56,7 @@ </header> <script> - (function() { + function initHeader() { var lastScrollY = getScrollPos().y; var documentElement = document.documentElement; @@ -87,5 +87,6 @@ }); storeScrollData(); - })(); + } + document.addEventListener('DOMContentLoaded', initHeader); </script> |