// JavaScript Document $(function() {   $('a[href^="#"],a[href*="#"]').not('#tabs a').on('click',function() { var mrg = $("#head").outerHeight() + 10; href = $(this).attr("href"); var hrefs=href.substring(href.indexOf("#")+1,href.length); href = "#"+hrefs;     var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top - mrg;     $('body,html').animate({scrollTop:position}, 500, 'swing'); return false; }); $(document).on('click','#header a.searchopen',function(){ $(this).toggleClass('open'); $(this).parent('div').parent('#header').next('#search').slideToggle(500); }); $(document).on('click','#header a.global',function(){ $(this).toggleClass('open'); $(this).parent('div').find('ul').slideToggle(500); }); $(document).on('click','.spmenu2 a.searchopen',function(){ $(this).toggleClass('open'); $('.spmenu2 #spsearch').slideToggle(500); }); $(document).on('click','.spmenu2 a.global',function(){ $(this).toggleClass('open'); $('.spmenu2 #splangbox').slideToggle(500); }); $('#head .gmenu > ul > li').on('mouseenter',function(){ $(this).addClass('menuon'); $(this).find('.mmenu').css('height',$(this).find('.mmenu > div').outerHeight()); }); $('#head .gmenu > ul > li').on('mouseleave',function(){ $(this).removeClass('menuon'); $(this).find('.mmenu').removeAttr('style'); }); $('#head .gmenu > ul > li .mmenu > div > span').on('click',function(){ $(this).parent('div').parent('.mmenu').removeAttr('style'); }); if( $('.mw_wp_form').length ){ $('.mw_wp_form td span.mwform-zip-field input:nth-child(1)').attr('id','zip'); $('.mw_wp_form td span.mwform-zip-field input:nth-child(2)').attr('id','zip1'); } setsize(); if($('#processings.search').length){ $('#processings a .detailbox').matchHeight(); } if($('#car .contents.processing').length){ $('#car .contents.processing .fbox > div > p').matchHeight(); } }); if(navigator.userAgent.match(/MSIE 10/i) || navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.match(/Edge\/12\./)) { $('body').on("mousewheel", function () { event.preventDefault(); var wd = event.wheelDelta; var csp = window.pageYOffset; window.scrollTo(0, csp - wd); }); } $(window).on('load',function(){ setsize(); movepos(); resetSP() }); $(window).on('resize',function () { setsize(); movepos(); resetSP() }); $(window).on('scroll',function () { //setsize(); }); $(window).on('orientationchange', function(){ setsize(); resetSP() }); function setsize(){ //var hsize = $("#head").outerHeight(); //$("#container").css("padding-top",hsize+"px"); } //他ページよりのアンカーリンク function movepos(){ var mrg = $("#head").outerHeight() + 10; var href = location.href; if(href.indexOf("#")>=0 || location.search){ var hrefs=href.substring(href.indexOf("#")+1,href.length); href = hrefs; if(href.substr(0, 3) == 'tab'){ return false; } var position = $("#"+href).offset().top; var speed = 500; $('body,html').animate({scrollTop:position-mrg}, speed, 'swing'); }else{ return false; } var hashString = location.hash.substr(1); history.replaceState('', document.title, window.location.pathname); } /**PCの場合アコーディオンリセット**/ function resetSP(){ if($(window).width() > 640 ){ $('#spmenu .menu-spmenu-container > ul > li > a').removeClass('open'); $('#spmenu .menu-spmenu-container > ul > li > ul').removeAttr('style'); $('#footer #menu-fmenu > li > a').removeClass('open'); $('#footer #menu-fmenu > li > ul').removeAttr('style'); $('#spmenu').removeClass('open'); $('#spbtn').removeClass('open'); } }