/*----------------------------- idリンク#消す ---------------------------*/ var new_url = location.protocol + '//' + location.host + location.pathname + location.search; jQuery(function($) { // // if (window.matchMedia("(min-width: 769px)").matches) { //画面横幅が768px以下のときの処理 // $('.loading_img').addClass('active'); // $(window).on('load', function () { // // ローディングが10秒以内で終わる場合、読み込み完了後ローディング非表示 // endLoading(); // }); // //10秒経過した段階で、上記の処理を上書き、強制終了 // setTimeout('endLoading()', 10000); // //ローディング非表示処理 // function endLoading() { // let fadeTime = 3000; // $('.loading_img').removeClass('active'); // $('#loading').delay(700).fadeOut(2000); // $('.main_wrapper').removeClass('fixed') // $('.kv_title').addClass('displayTop'); // }; // // } else { //画面横幅が769px以上のときの処理 // // $('#loading').fadeOut(3000); // // $('.main_wrapper').removeClass('fixed') // // }; // $('.d_nav_list_item_service').hover(function() { // $('.d_nav_list_item_service').addClass('hover'); // }); // var copyrightHeight = $('.copyright').outerHeight(); // $('copyright').css('margin-top', copyrightHeight + 'px') // // $('.footer_tel-container').css('margin-bottom', copyrightHeight + 'px') /*----------------------------- フェードインアニメーション ---------------------------*/ // フェードインアニメーション $('.loadin').addClass('active'); $(window).on('scroll', function() { var winHeight = $(window).height(); var scrollPos = $(window).scrollTop(); // フェードインアニメーション $('.scrollin').each(function() { var activePos = winHeight / 4; var elemPos = $(this).offset().top + activePos; if (scrollPos > elemPos - winHeight) { $(this).addClass('active'); } }); if (window.matchMedia('(max-width:768px)').matches) { $('.sp_btn-container').each(function() { if (scrollPos > winHeight / 4) { $(this).addClass('active'); } else { $(this).removeClass('active'); } }); }; }); /*----------------------------- ナビゲーション挙動 ---------------------------*/ if (window.matchMedia('(min-width:769px)').matches) { $('.drawer-item').hover(function() { // 乗せたボタンに連動したメガメニューをスライドで表示させる $(this).find('.gnav-sub-list').stop().fadeIn(); // マウスをボタンから離した際のイベントを設定 }, function() { // マウスを離したらメガメニューをスライドで非表示にする $(this).find('.gnav-sub-list').stop().fadeOut(); }); } else if (window.matchMedia('(max-width:768px)').matches) { $(".drawer-item").on("click", function() { $(this).children('.gnav-sub-list').slideToggle(400); $(this).toggleClass("active");//追加部分 }); }; /*----------------------------- SP表示 ナビゲーション挙動 ---------------------------*/ // $('.openbtn').on('click', function() {//ボタンがクリックされたら // $(this).toggleClass('active');//ボタン自身に activeクラスを付与し // $('.header-area').toggleClass('panelactive');//ナビゲーションにpanelactiveクラスを付与 // }); // $('.header-area a').on('click', function() {//ナビゲーションのリンクがクリックされたら // $('.openbtn').removeClass('active');//ボタンの activeクラスを除去し // $('.header-area').removeClass('panelactive');//ナビゲーションのpanelactiveクラスも除去 // }); if (window.matchMedia('(max-width:768px)').matches) { $(".openbtn").click(function() {//ボタンがクリックされたら $(this).toggleClass('active');//ボタン自身に activeクラスを付与し $(".header-area").toggleClass('panelactive');//ナビゲーションにpanelactiveクラスを付与 }); $(".header-area a").click(function() {//ナビゲーションのリンクがクリックされたら $(".openbtn").removeClass('active');//ボタンの activeクラスを除去し $(".header-area").removeClass('panelactive');//ナビゲーションのpanelactiveクラスも除去 }); var state = false; var pos; $(".openbtn, .nav-link").click(function() { if (state == false) { pos = $(window).scrollTop(); $("body").addClass("fixed").css({ "top": - pos }); state = true; } else { $("body").removeClass("fixed").css({ "top": 0 }); window.scrollTo(0, pos); state = false; } }); }; // // ナビゲーションメニュー表示時 // // 背景をスクロールさせない // var state = false; // var pos; // $('.openbtn').on('click', function() { // if (state == false) { // pos = $(window).scrollTop(); // $('body').addClass('fixed').css({ 'top': - pos }); // state = true; // } else { // $('body').removeClass('fixed').css({ 'top': 0 }); // window.scrollTo(0, pos); // state = false; // } // }); /*----------------------------- ヘッダー挙動 ---------------------------*/ // SP無効 // if (window.matchMedia('(min-width:1025px)').matches) { // var startPos = 0, winScrollTop = 0; // $(window).on('scroll', function() { // winScrollTop = $(this).scrollTop(); // if (winScrollTop >= startPos) { // if (winScrollTop >= 40) { // $('.header').addClass('hide'); // } // } else { // $('.header').removeClass('hide'); // } // startPos = winScrollTop; // }); // }; /*----------------------------- スムーススクロール ---------------------------*/ $('.service-index_list-item a[href*="#"]').click(function(e) { var target = $(this.hash === "" ? "html" : this.hash); if (target.length) { e.preventDefault(); var headerHeight = $("header").outerHeight(); var adjust = 100; var position = target.offset().top - headerHeight + adjust; $("html, body").animate({ scrollTop: position }, 500, "swing"); // if (!target.is("html")) { // // URLにハッシュを含める // history.pushState(null, '', this.hash); // } } }); // // // 別ページ遷移後のスムーススクロール // var urlHash = location.hash; // if (urlHash) { // var target = $(urlHash); // if (target.length) { // // ページトップから開始(ブラウザ差異を考慮して併用) // history.replaceState(null, '', window.location.pathname); // $("html,body").stop().scrollTop(0); // $(window).on("load", function() { // var headerHeight = $("header").outerHeight(); // var position = target.offset().top - headerHeight - 20; // $("html, body").animate({ scrollTop: position }, 500, "swing"); // // ハッシュを再設定 // // history.replaceState(null, '', window.location.pathname + urlHash); // }); // } // } $('.cat-topic').on('click', function() { $(this).toggleClass('open'); $('.cat-list').slideToggle(); }); const swiper = new Swiper(".keyvisual .swiper", { loop: true, effect: "fade", // フェード切り替え // 自動再生 autoplay: { delay: 4000, // 4秒後に次のスライドへ disableOnInteraction: false, // ユーザーが操作しても自動再生を継続 }, speed: 2000, // 2秒かけてフェード pagination: { el: ".swiper-pagination", clickable: true, }, }); });