cwadayi commited on
Commit
f00581b
·
verified ·
1 Parent(s): 813268a

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +3 -3
script.js CHANGED
@@ -8,7 +8,7 @@ document.addEventListener('DOMContentLoaded', () => {
8
  }
9
  });
10
  }, {
11
- threshold: 0.1
12
  });
13
  sections.forEach(section => {
14
  sectionObserver.observe(section);
@@ -48,10 +48,10 @@ document.addEventListener('DOMContentLoaded', () => {
48
  // --- ★★★★★ 修正並簡化後的燈箱功能 ★★★★★ ---
49
  document.body.addEventListener('click', function(event) {
50
  // 檢查點擊的是否是帶有 .lightbox-trigger 的 <a> 標籤
51
- if (event.target.closest('.lightbox-trigger')) {
 
52
  event.preventDefault(); // 阻止連結的默認跳轉行為
53
 
54
- const trigger = event.target.closest('.lightbox-trigger');
55
  const imageUrl = trigger.getAttribute('href');
56
 
57
  // 如果頁面上已經有燈箱,就不要再創建
 
8
  }
9
  });
10
  }, {
11
+ threshold: 0.05 // *** 降低觸發門檻,修復手機版底部區塊無法顯示問題 ***
12
  });
13
  sections.forEach(section => {
14
  sectionObserver.observe(section);
 
48
  // --- ★★★★★ 修正並簡化後的燈箱功能 ★★★★★ ---
49
  document.body.addEventListener('click', function(event) {
50
  // 檢查點擊的是否是帶有 .lightbox-trigger 的 <a> 標籤
51
+ const trigger = event.target.closest('.lightbox-trigger');
52
+ if (trigger) {
53
  event.preventDefault(); // 阻止連結的默認跳轉行為
54
 
 
55
  const imageUrl = trigger.getAttribute('href');
56
 
57
  // 如果頁面上已經有燈箱,就不要再創建