summaryrefslogtreecommitdiff
path: root/_includes/views
diff options
context:
space:
mode:
authorJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-24 14:10:57 +0800
committerJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-24 14:10:57 +0800
commitcda49e03018d3dbbe8b9dc3927719471150c1608 (patch)
treea94523d13898c106c90e4d9285cf6136d45b7a33 /_includes/views
parent92840887d2591d8ba9b92074e193ef1a922c118d (diff)
update: perfect animation, compatibility issue
Diffstat (limited to '_includes/views')
-rw-r--r--_includes/views/header.html17
1 files changed, 5 insertions, 12 deletions
diff --git a/_includes/views/header.html b/_includes/views/header.html
index 835d4cb..f23401f 100644
--- a/_includes/views/header.html
+++ b/_includes/views/header.html
@@ -62,21 +62,14 @@
<script>
(function() {
- var supportPageOffset = window.pageXOffset !== undefined;
- var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
-
- function scrollY() {
- return supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
- }
-
- var lastScrollY = scrollY();
- var dataset = document.documentElement.dataset;
+ var lastScrollY = getScrollPos().y;
+ var documentElement = document.documentElement;
function storeScrollData() {
- var y = scrollY();
+ var y = getScrollPos().y;
{%- if banner and header_transparent -%}
- dataset.headerTransparent = "";
+ documentElement.setAttribute("data-header-transparent", "");
{%- endif -%}
var scrollStatus = "";
@@ -91,7 +84,7 @@
}
lastScrollY = y;
- dataset.scrollStatus = scrollStatus;
+ documentElement.setAttribute("data-scroll-status", scrollStatus);
}
window.addEventListener('scroll', function(e) {