/* Smoothscroll
------------------------------------------------------------------- */
$(function () {
var windowWidth = $(window).width();
var windowSm = 767;
if (windowWidth <= windowSm) {
//横幅が767pxより小さい時
var headerHegiht = $('.header_box').outerHeight(); //ヘッダーの高さを取得
$(function () {
pageLink(headerHegiht);
});
} else {
//横幅が767pxより大きい時
$(function () {
pageLink(0);
});
}
function pageLink(h) {
$('a[href^=#]').click(function () {
var href = $(this).attr("href");
var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top;
$('body,html').animate({
scrollTop: position - h
}, 200);
return false;
});
}
});
/* スマホナビ
------------------------------------------------------------------- */
$(function(){
var $spNavBtn = $('#spNavBtn');
var $headerMenu = $('.header_menu_list');
$spNavBtn.on('click', function(){
$(this).toggleClass('active');
$headerMenu.fadeToggle();
});
$headerMenu.find('a').on('click', function(){
if (window.innerWidth <= 768) {
$spNavBtn.click();
}
});
});
/* viewport切替え
---------------------------------------------------------------- */
$(function(){
var ua = navigator.userAgent;
if((ua.indexOf('iPhone') > 0) || ua.indexOf('iPod') > 0 || (ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0)){
$('head').prepend('');
} else {
$('head').prepend('');
}
});