From c895b4ece1688c00bdd9b88daf6493eb20fc48e8 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Thu, 19 Sep 2024 14:14:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E7=BD=AE=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E9=98=88=E5=80=BC=E5=92=8C=E9=98=B2=E6=8A=96=E5=A4=84=E7=90=86?= =?UTF-8?q?=20iPhone=20=E5=AF=BC=E8=88=AA=E5=81=B6=E5=B0=94=E4=BC=9A?= =?UTF-8?q?=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/views/mobile_first/ch-pc.php | 44 ++++++++++++++--------- application/views/mobile_first/ch.php | 32 +++++++++++------ application/views/mobile_first/gh-pc.php | 46 +++++++++++++++--------- application/views/mobile_first/gh.php | 28 ++++++++++----- 4 files changed, 99 insertions(+), 51 deletions(-) diff --git a/application/views/mobile_first/ch-pc.php b/application/views/mobile_first/ch-pc.php index 929d625b..0b6281ee 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 d42b48af..868396e6 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 @@ } -