//ページトップに戻るボタン document.addEventListener('DOMContentLoaded', () => { const btn = document.querySelector('.pagetop'); if (!btn) return; window.addEventListener('scroll', () => { btn.classList.toggle('is-show', window.scrollY > 300); }); btn.addEventListener('click', (e) => { e.preventDefault(); window.scrollTo({ top: 0, behavior: 'smooth' }); }); });