//関連画像がある場合 if (currentNext && currentNext.classList.contains('q1-related-image')) { const imageToShow = document.querySelector('[class*="related-image"]'); imageToShow.style.display = 'block'; imageToShow.scrollIntoView({ behavior: 'smooth' }); } else { //...省略 }