// JavaScript Document $(function() {   $('a[href^="#"],a[href*="#"]').on('click',function() { var mrg = $("#head").outerHeight() + 10; mrg = $("#head #logo").outerHeight() + 40; 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','#gotop span',function(e) { e.preventDefault;     $('body,html').animate({scrollTop:0}, 500, 'swing'); return false; }); setsize(); //本アップ対応 $("a.nolink").click(function(e) { e.preventDefault; return false; }); if($('.mwform-zip-field').length){ $('.mwform-zip-field > input:first-child').attr('id','zip'); $('.mwform-zip-field > input:last-child').attr('id','zip1'); } if($('input.hidden').length){ $('input.hidden').attr('readonly','readonly'); } }); $(window).on('load',function(){ setsize(); movepos(); }); $(window).on('resize',function () { setsize(); movepos(); }); $(window).on('scroll',function () { setsize(); }); $(window).on('orientationchange', function(){ setsize(); }); function setsize(){ var hsize = $("#header").outerHeight(); $("#container").css("padding-top",hsize+"px"); if($('.contents.link').length){ $('.wrap .contents.link').matchHeight(); } } //他ページよりのアンカーリンク function movepos(){ var mrg = $("#head").outerHeight(); var href = location.href; if(href.indexOf("#")>=0 || location.search){ var hrefs=href.substring(href.indexOf("#")+1,href.length); href = hrefs; 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); }