var setFillHeight = () => { const vh = window.innerHeight * 0.01; document.documentElement.style.setProperty('--vh', `${vh}px`); } let vw = window.innerWidth; window.addEventListener('resize', () => { // if (vw === window.innerWidth) { // // 画面の横幅にサイズ変動がないので処理を終える // return; // } // 画面の横幅のサイズ変動があった時のみ高さを再計算する vw = window.innerWidth; setFillHeight(); }); // 初期化 setFillHeight(); const breakpoint = window.matchMedia("(max-width:768px)"); breakpoint.addEventListener("change", () => { window.location.reload(); }); if (window.matchMedia("(max-width:768px)").matches) { //ヘッダーSP ナビゲーション開閉 window.addEventListener('load', function () { $('.js-accordionBtn').on('click', function () { if ($(this).hasClass('is-active')) { $(this).removeClass('is-active'); $(this).next('.js-accordion').stop(0.3).slideUp(); } else { $(this).addClass('is-active'); $(this).next('.js-accordion').stop(0.3).slideDown(); } }); }); }