////////////////////////////////////////////
//SP判定(TOPなどSPリダイレクト系ページには読み込まれていない)
////////////////////////////////////////////
if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/blackberry/i)){
//SP見た目の処理
$('body').addClass('sp');
//SCRIPT読み込み
$.getScript("/sp/inc/js/sp-slidemenu.js?20220915", function(){
$.getScript("/inc/responsive/responsive.js", function(){});
$.getScript("/inc/responsive/responsive_replace_navigation.js", function(){
$.getScript("/inc/responsive/responsive_table.js")
});
});
//CSS読み込み
$("link#respnsive").after("");
$("link#sp-slidemenu").attr({rel: "stylesheet",type: "text/css",href: "/sp/inc/css/common/sp-slidemenu.css"});
$("link#sp-slidemenu").after("");
$("link#responsive").attr({rel: "stylesheet",type: "text/css",href: "/inc/responsive/responsive.css"});
$("link#responsive").after("");
$("link#overwrite").attr({rel: "stylesheet",type: "text/css",href: "/inc/responsive/overwrite.css"});
$("link#responsive").after("");
$("link#sp2022").attr({rel: "stylesheet",type: "text/css",href: "/inc/css/common/sp/newComponents-sp.css"});
}
$(document).ready(function() {
//ALTを別属性に置き換え(CSSでのテキスト表示用)
$("#hnavi a,.sp-totxt").each(function(i){
$(this).attr("data-label", $("img",this).attr("alt"));
});
});
// スマホの時に「responsive.js」のせいでアンカーリンクがずれるのを調整
function mySPAnchorLink() {
let url = location.href;
if(url.indexOf("?sp_id=") != -1){
let id = url.split("?sp_id=");
let $target = $('#' + id[id.length - 1]);
if($target.length){
let position = $target.offset().top;
// console.log(position);
$("html, body").animate({scrollTop:position}, 400, "swing");
}
}
}
$(window).on('load',function(){
$(function() {
setTimeout(mySPAnchorLink, 500)
});
})