summaryrefslogtreecommitdiff
path: root/_includes/views/header.html
diff options
context:
space:
mode:
authorjeffreytse <jeffreytse.mail@gmail.com>2021-06-28 18:44:37 +0800
committerjeffreytse <jeffreytse.mail@gmail.com>2021-06-28 18:45:05 +0800
commit4e3e599bbff99261206cefaa1159e61d7d353262 (patch)
tree89e415731fc36169d8d535fabd78144f152c0f87 /_includes/views/header.html
parent735c2ad48be93582457395aa172f9951dadff37e (diff)
perf: postpone initializing site header
Postpone this step to the stage that DOM loaed, but img and css not
Diffstat (limited to '_includes/views/header.html')
-rw-r--r--_includes/views/header.html5
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>