// JavaScript Document $(function() {   $('a[href^="#"],a[href*="#"]').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; }); if($('input.zip').length){ $('input.zip:first-child').attr('id','zip'); $('input.zip:nth-child(2)').attr('id','zip1'); } }); $(window).on('load',function(){ movepos(); }); $(window).on('resize',function () { //movepos(); }); $(window).on('scroll',function () { }); $(window).on('orientationchange', function(){ }); //他ページよりのアンカーリンク 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; //alert(href); 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); }