| 123456789101112131415161718192021222324252627282930313233343536373839 | 
							- // 切換分頁時移至列表區塊
 
- document.addEventListener("DOMContentLoaded", () => {
 
-     if (document.querySelector('#news-block')) {
 
-         let offsetHeight = document.querySelector('#news-block').offsetTop;
 
-         if (offsetHeight) window.scrollTo(0, offsetHeight);
 
-     }
 
- });
 
- function historyBack() {
 
-     let prevPage = window.location.href;
 
-     // 若無法返回上一頁則回到首頁
 
-     window.history.go(-1);
 
-     setTimeout(() => {
 
-         if (window.location.href == prevPage) {
 
-             window.location.href = "/";
 
-         }
 
-     }, 500);
 
- }
 
- let topBtn = document.querySelector('.top-btn');
 
- window.onscroll = () => {
 
-     const px = 100;
 
-     if (topBtn) {
 
-         if (document.documentElement.scrollTop > px) {
 
-             topBtn.classList.add("show");
 
-         } else {
 
-             topBtn.classList.remove("show");
 
-         }
 
-     }
 
- };
 
- if (topBtn) {
 
-     topBtn.addEventListener('click', () => {
 
-         document.documentElement.scrollTop = 0;
 
-     }, false);
 
- }
 
 
  |