diff --git a/application/views/mobile_first/ch-pc.php b/application/views/mobile_first/ch-pc.php index 873f2e50..384b0959 100644 --- a/application/views/mobile_first/ch-pc.php +++ b/application/views/mobile_first/ch-pc.php @@ -42,7 +42,7 @@ })(window, document, 'script', 'dataLayer', 'GTM-T75N4LL'); - diff --git a/application/views/mobile_first/ch.php b/application/views/mobile_first/ch.php index b32b70dc..3bac11da 100644 --- a/application/views/mobile_first/ch.php +++ b/application/views/mobile_first/ch.php @@ -34,7 +34,7 @@ })(window, document, 'script', 'dataLayer', 'GTM-T75N4LL'); - - +
@@ -277,7 +277,7 @@ height="100">

Ensure Your Satisfactory

@@ -420,20 +420,32 @@ + (function (w, d, i) { + function debounce(func, wait) { + let timeout; + return function() { + const context = this; + const args = arguments; + clearTimeout(timeout); + timeout = setTimeout(() => func.apply(context, args), wait); + }; + } + + var navbar = d.getElementById(i); + var prevScrollpos = w.pageYOffset; + w.onscroll = debounce(function () { + var currentScrollPos = w.pageYOffset; + if (Math.abs(currentScrollPos - prevScrollpos) > 5) { // 滚动阈值 + if (prevScrollpos > currentScrollPos) { + navbar.style.top = '0'; + } else { + navbar.style.top = '-100px'; + } + prevScrollpos = currentScrollPos; + } + }, 25) // 防止快速滚动时频繁触发 + })(window, document, 'header'); + diff --git a/application/views/mobile_first/gh.php b/application/views/mobile_first/gh.php index f085b966..e543c4d0 100644 --- a/application/views/mobile_first/gh.php +++ b/application/views/mobile_first/gh.php @@ -448,19 +448,31 @@ } -