Lashtw commited on
Commit
5d2d89f
·
verified ·
1 Parent(s): 8367ea0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +2 -4
index.html CHANGED
@@ -465,12 +465,10 @@
465
  const navLinks = document.querySelectorAll('.nav-link');
466
 
467
  // 修正 Observer 選項,將觸發線調整至視窗上方
468
- // rootMargin: '-15% 0px -80% 0px' 代表:
469
- // 當元素進入視窗頂部 15% ~ 20% 的範圍內時,就會觸發 active
470
- // 這樣在元素捲動到標題下方時,能更快偵測到
471
  const observerOptions = {
472
  root: null,
473
- rootMargin: '-15% 0px -80% 0px',
474
  threshold: 0
475
  };
476
 
 
465
  const navLinks = document.querySelectorAll('.nav-link');
466
 
467
  // 修正 Observer 選項,將觸發線調整至視窗上方
468
+ // 改用較寬的偵測範圍 (-20% ~ -50%) 來解決區塊間距造成的判定問題
 
 
469
  const observerOptions = {
470
  root: null,
471
+ rootMargin: '-20% 0px -50% 0px',
472
  threshold: 0
473
  };
474