jQuery(function() { jQuery("a[href^=#]").click(function(){ var elmID = jQuery(this).attr("href"); var posi = 0; if(jQuery(elmID).size()){ posi = jQuery(elmID).offset().top -0; BodySlider(posi); return false; } }); function BodySlider(HashOffset){ jQuery("html,body").animate({ scrollTop: HashOffset }, 600); } }); /*============================================== 要素の高さを揃える ==============================================*/ $(function(){ $('.STF_WEBNAME').matchHeight(); $('.label').matchHeight(); }); /*============================================== ヘッダー位置ずれ防止 ==============================================*/ $(function () { var headerHight = 70; //ヘッダの高さ $('a[href^=#]').click(function(){ var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top-headerHight; //ヘッダの高さ分位置をずらす $("html, body").animate({scrollTop:position}, 550, "swing"); return false; }); });