// JavaScript Document //lang fontsize jQuery(function($){ $("#tk_header .lang dt").click(function(){ $("#tk_header .lang dd").slideToggle(); $(this).toggleClass("active"); }); }); //site-menu jQuery(function($){ $('.tk_sp-menu-btn a').on('click',function(){ if($('.tk_site-menu').hasClass('off')){ $('.tk_site-menu') .removeClass('off') .animate({'marginTop': '0'}, 300).addClass('on'); $('.tk_sp-menu-btn a').addClass("active"); }else{ $('.tk_site-menu') .addClass('off') .animate({'marginTop': '100vh'}, 300); $('.tk_sp-menu-btn a').removeClass("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('on'); }else{ $(this).removeClass('on'); } }); } }); }); }); //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; // }); //}); //pagetop jQuery(function($) { var showFlug = false; var topBtn = $('.kuruppa'); topBtn.css('bottom', '-300px'); $(window).scroll(function () { if ($(this).scrollTop() > 150) { if (showFlug == false) { showFlug = true; topBtn.animate({'bottom' : '-38px'}, 600); topBtn.animate({'bottom' : '-53px'}, 450); topBtn.animate({'bottom' : '-48px'}, 500); } } else { if (showFlug) { showFlug = false; topBtn.animate({'bottom' : '-300px'}, 500); } } }); //スクロールしてトップ topBtn.click(function () { var speed = 500; var href = $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top; $('.tk_pagetop').animate({'bottom': '-5px'}, 50); $('.tk_pagetop').animate({'bottom': '38vh'}, 400); $('.tk_pagetop').animate({'bottom': '0px'}, 600); $('body,html').delay(200).animate({scrollTop: position}, speed, "swing"); return false; }); });