// スクロールフェード $(function () { // スクロール時のクラス付与処理 function handleScroll(selector, className, offsetMobile, offsetDesktop) { $(selector).each(function () { var elemPos = $(this).offset().top; var scroll = $(window).scrollTop(); var windowHeight = $(window).height(); if (navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/i)) { // モバイル端末の場合 if (scroll > elemPos - windowHeight - offsetMobile) { $(this).addClass(className); } } else { // PCの場合 if (scroll > elemPos - windowHeight + offsetDesktop) { $(this).addClass(className); } } }); } // スクロールイベント $(window).on("scroll", function () { handleScroll('.fin', 'sin', 50, 100); // `fin` に対する処理 handleScroll('.eft', 'eon', 50, 200); // `eft` に対する処理 }); // 初期状態でも適用 $(window).trigger("scroll"); }); // グローバルナビゲーション モーダル仕様 document.addEventListener('DOMContentLoaded', () => { const menuBtn = document.getElementById('menu'); const remodalInstance = $('[data-remodal-id=menu-modal]').remodal(); // メニューボタンクリックでモーダルを開く menuBtn.addEventListener('click', () => { remodalInstance.open(); }); }); // グローバルナビゲーション スクロール固定 document.addEventListener("DOMContentLoaded", function () { const header = document.querySelector("header"); const recruitHeader = document.querySelector(".recruit-header"); // 状態を管理するフラグ let isFixed = false; window.addEventListener("scroll", function () { const headerRect = header.getBoundingClientRect(); const recruitHeaderRect = recruitHeader.getBoundingClientRect(); // recruit-headerがトップに来たら固定 if (recruitHeaderRect.top <= 0 && !isFixed) { recruitHeader.classList.add("fixed"); isFixed = true; } // headerが見えるようになったら固定解除 if (headerRect.bottom > 0 && isFixed) { recruitHeader.classList.remove("fixed"); isFixed = false; } }); }); $(function () { $('.item-ttl').click(function () { $(this).next().slideToggle(); $(this).toggleClass('on'); }); $(window).on('resize', function () { if ('none' == $('.item-ttl').css('pointer-events')) { $('.spmc').attr('style', ''); } }); }); // SP画像横スクロール $(function() { var hintBtn = $('.scroll-box'); hintBtn.scroll(function () { if ($(this).scrollLeft() > 1) { $(this).addClass('on'); // 横スクロールでクラスを追加 } else { $(this).removeClass('on'); // 横スクロールが戻るとクラスを削除 } }); }); $(function () { const mediaQuery = window.matchMedia('(max-width: 767px)'); handleScroll(mediaQuery); mediaQuery.addEventListener('change', (e) => handleScroll(e)); function handleScroll(mm) { const offset = mm.matches ? 0 : 50; const $sections = $(".in-section"); const $buttons = $(".in-btn"); // ページ内スクロール処理 $buttons.off("click keydown").on("click keydown", function (e) { // Enter(13) または Space(32) も許可 if (e.type === "keydown" && e.key !== "Enter" && e.key !== " ") { return; } e.preventDefault(); $(window).trigger("scroll.fixedMenu"); const index = $buttons.index(this); if ($sections.eq(index).length) { const targetPosition = $sections.eq(index).offset().top - offset; $("html,body").animate({ scrollTop: targetPosition }, 'slow'); } return false; }); // メニューのスクロール固定処理 const $menu = $('.inner-menu-wrap'); const menuOffset = $menu.length && $menu.offset() ? $menu.offset().top : null; if (menuOffset !== null) { const navPos = menuOffset - (mm.matches ? 50 : 100); const $contentWrap = $('.inner-content-wrap'); $(window).off("scroll.fixedMenu").on('scroll.fixedMenu', function () { const scrollTop = $(this).scrollTop(); const contentBottom = $contentWrap.offset().top + $contentWrap.outerHeight(); // inner-content-wrap の最下部が画面の最上部に来たら fixed を解除 if (scrollTop > navPos && scrollTop < contentBottom - 200) { $menu.addClass('inner-menu-wrap_fixed'); } else { $menu.removeClass('inner-menu-wrap_fixed'); } }); } // active クラス処理 $(window).off("scroll.activeSection").on("scroll.activeSection", function () { const scrollPosition = $(this).scrollTop() + offset + 40; if ($(this).scrollTop() === 0) { $buttons.removeClass("active"); return; } $sections.each(function (index) { const sectionTop = $(this).offset().top; const sectionBottom = sectionTop + $(this).outerHeight(); if (scrollPosition >= sectionTop && scrollPosition < sectionBottom) { $buttons.removeClass("active"); $buttons.eq(index).addClass("active"); } }); }); } }); document.addEventListener('DOMContentLoaded', () => { const header = document.querySelector('.recruit-header.fixed'); function adjustHeaderWidth() { if (!header) return; const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; header.style.width = `calc(100vw - ${scrollbarWidth}px)`; } // Remodalの開閉イベント $(document).on('opened', '.remodal', adjustHeaderWidth); // モーダルが閉じたら元の幅に戻す $(document).on('closed', '.remodal', () => { if (!header) return; header.style.width = '100vw'; }); });