// JavaScript Document //lang fontsize jQuery(function($){ $(".tk_header .tk_lang dt").click(function(){ $(".tk_header .tk_lang dd").slideToggle(); $(this).toggleClass("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'); } }); } }); }); }); //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"); } }); }); //pagetop $(function() { var topBtn = $('.tk_pagetop'); topBtn.hide(); //スクロールが100に達したらボタン表示 $(window).scroll(function () { if ($(this).scrollTop() > 150) { //ボタンの表示方法 topBtn.fadeIn(); } else { //ボタンの非表示方法 topBtn.fadeOut(); } }); //スクロールしてトップ topBtn.click(function () { $('body, html').animate({ scrollTop: 0 }, 500); return false; }); });