// JavaScript Document //lang fontsize jQuery(function($){ $(".tk_lang dt").click(function(){ $(".tk_lang dd").slideToggle(); $(this).toggleClass("tk_active"); }); $(".tk_fontsize dt").click(function(){ $(".tk_fontsize dd").slideToggle(); $(this).toggleClass("tk_active"); }); $(".tk_useful dt").click(function(){ $(".tk_useful dd").slideToggle(); $(this).toggleClass("tk_active"); }); $(".tk_new-header .tk_lang dt").click(function(){ $(".tk_new-header .tk_lang dd").slideToggle(); $(this).toggleClass(".tk_active"); }); $(".tk_sp-lang dt").click(function(){ $(".tk_sp-lang dd").slideToggle(); $(this).toggleClass("tk_active"); }); }); // ヘッダー追従 jQuery(function($){ $(window).scroll(function () { if($(window).scrollTop() > 200) { $(".tk_new-gnav,.tk_new-h-logo,.tk_new-spnav").addClass('tk_is-fixed'); if ($(window).width() > 800) { $("body").css("padding-top","49px"); } else if ($(window).width() <= 799) { $("body").css("padding-top","65px"); } } else { $(".tk_new-gnav,.tk_new-h-logo,.tk_new-spnav").removeClass('tk_is-fixed'); $("body").css("padding-top","0px"); } }); }); //new-menu jQuery(function($){ $('.tk_new-menu-btn a').on('click',function(){ if($('.tk_new-menu').hasClass('tk_off')){ $('.tk_new-menu') .removeClass('tk_off') .animate({'marginTop': '0'}, 300).addClass('tk_on'); $('.tk_new-spnav,.tk_new-menu-btn a').addClass("tk_active"); }else{ $('.tk_new-menu') .addClass('tk_off') .animate({'marginTop': '120vh'}, 300); $('.tk_new-spnav,.tk_new-menu-btn a').removeClass("tk_active"); } }); }); //site-menu jQuery(function($){ $('.tk_sp-menu-btn a').on('click',function(){ if($('.tk_site-menu').hasClass('tk_off')){ $('.tk_site-menu') .removeClass('tk_off') .animate({'marginTop': '0'}, 300).addClass('tk_on'); $('.tk_sp-menu-btn a').addClass("tk_active"); }else{ $('.tk_site-menu') .addClass('tk_off') .animate({'marginTop': '100vh'}, 300); $('.tk_sp-menu-btn a').removeClass("tk_active"); } }); }); //spnav jQuery(function($) { $(window).bind('load', function() { $(window).scroll(function(){ var w = window.innerWidth; var x = 800; if (w <= x) { $('.tk_spnav').each(function(){ var targetPosition = $(this).offset().top; if(targetPosition >= 50){ $(this).addClass('tk_on'); }else{ $(this).removeClass('tk_on'); } }); } }); }); }); //search-menu jQuery(function($){ $(".tk_search-menu dt").on("click", function() { $(this).next().toggleClass("tk_is-active"); $(this).toggleClass("tk_is-active"); }).on('keydown', function(e) { if (e.key === 'Enter') { $(this).next().toggleClass("tk_is-active"); $(this).toggleClass("tk_is-active"); } }); $('.tk_search-menu .__dl-deactive').click(function () { $(this).closest('dd').toggleClass('tk_is-active').prev().toggleClass('tk_is-active'); }); }); //Modernizr $(function(){ if (!Modernizr.svg){ $('img').each(function() { $(this).attr('src', $(this).attr('src').replace(/\.svg/gi,'.png')); }); } }); //pagescroll jQuery(function($) { $('a[href^="#"]').not('.noScr a').click(function() { var speed = 500; var href = $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); if (target.offset()) { var position = target.offset().top; $("html, body").animate({scrollTop: position}, speed, "swing"); } return false; }); }); //fontsize jQuery(function($) { $('#js-fs-normal').each(function() { //標準ボタンのHTML取得 const BtnFsNormal = document.getElementById('js-fs-normal'); //拡大ボタンのHTML取得 const BtnFsLarge = document.getElementById('js-fs-large'); // htmlタグ取得 const RootTag = document.documentElement; // alert出力文 const MaxMessage = encodeURIComponent('これ以上文字のサイズを大きくできません。'); const ResetMessage = encodeURIComponent('標準文字サイズに戻しますか?'); //拡大回数カウント用 var fsUpCount = 0; // 標準ボタン BtnFsNormal.addEventListener('click', function(){ setFsReset(); return false; }); // 拡大ボタン BtnFsLarge.addEventListener('click', function(){ setFsUp(); return false; }); function setFsUp(){ if(fsUpCount === 5) { alert(decodeURIComponent(MaxMessage)); }else if(fsUpCount === 4) { RootTag.classList.add('is-fs-xxxl'); RootTag.classList.remove('is-fs-xxl'); fsUpCount = 5; }else if(fsUpCount === 3) { RootTag.classList.add('is-fs-xxl'); RootTag.classList.remove('is-fs-xl'); fsUpCount = 4; }else if(fsUpCount === 2) { RootTag.classList.add('is-fs-xl'); RootTag.classList.remove('is-fs-l'); fsUpCount = 3; }else if(fsUpCount === 1) { RootTag.classList.add('is-fs-l'); RootTag.classList.remove('is-fs-m'); fsUpCount = 2; }else if(fsUpCount === 0) { RootTag.classList.add('is-fs-m'); fsUpCount = 1; }else if(fsUpCount === null) { RootTag.classList.add('is-fs-m'); fsUpCount = 1; } BtnFsNormal.classList.remove('is-active'); BtnFsLarge.classList.add('is-active'); // cookieに保存 docCookies.setItem('fsCookies', fsUpCount, 30, '/'); } function setFsReset(){ var resetModal = confirm(decodeURIComponent(ResetMessage)); if (resetModal) { fsUpCount = 0; RootTag.removeAttribute('class'); } // cookieに保存 docCookies.setItem('fsCookies', fsUpCount, 30, '/'); } function getCookie(){ fsUpCount = docCookies.getItem('fsCookies'); if(fsUpCount > 0) { setFsUp(); } } window.addEventListener('load', getCookie, false); }); }); //tabikura sp rewrite jQuery(function ($) { var mql = window.matchMedia('screen and (max-width: 400px)'); function checkBreakPoint(mql) { $('a[href^="http://yado.kumamoto.guide/dom/s/"],a[href^="http://yado.kumamoto.guide/dom/ss/"]').each(function () { var href = $(this).attr('href'); if (href) { if (mql.matches) { $(this).attr('href', href.replace(/^http:\/\/yado.kumamoto.guide\/dom\/ss?\//, 'http://yado.kumamoto.guide/dom/ss/')); // SP } else { $(this).attr('href', href.replace(/^http:\/\/yado.kumamoto.guide\/dom\/ss?\//, 'http://yado.kumamoto.guide/dom/s/')); // PC } } }) } mql.addListener(checkBreakPoint); checkBreakPoint(mql); });