$(function () {
//トグルメニュー
$(".header__hamburger").click(function () {
$(".g-nav__sp").toggleClass("active");
$(".g-nav__bg").toggleClass("active");
$(".header__gnav--sp").toggleClass("active");
$(this).toggleClass("active");
$("html").toggleClass("active");
l; //モーダルを開いた時のスクロール位置を保持
var scrollPosition;
//iOS(iPadOSを含む)かどうかのUA判定
var ua = window.navigator.userAgent.toLowerCase();
var isiOS = ua.indexOf("iphone") > -1 || ua.indexOf("ipad") > -1 || (ua.indexOf("macintosh") > -1 && "ontouchend" in document);
//bodyのスクロール固定
function bodyFixedOn() {
if (isiOS) {
// iOSの場合
scrollPosition = $(window).scrollTop();
$("html.active").css("position", "fixed");
$("html.active").css("top", "-" + scrollPosition + "px");
} else {
// それ以外
$("html.active").css("overflow", "hidden");
}
}
//bodyのスクロール固定を解除
function bodyFixedOff() {
if (isiOS) {
// iOSの場合
$("html.active").css("position", "");
$("html.active").css("top", "");
$(window).scrollTop(scrollPosition);
} else {
// それ以外
$("html.active").css("overflow", "");
}
}
bodyFixedOn();
bodyFixedOff();
});
// #で始まるアンカーをクリックした場合に処理
$("a[href]").click(function () {
// スクロールの速度
var speed = 400; // ミリ秒
// アンカーの値取得
var href = $(this).attr("href");
// 移動先を取得
var target = $(href == "#" || href == "" ? "html" : href);
// 移動先を数値で取得
var position = target.offset().top;
// スムーススクロール
$("body,html").animate({ scrollTop: position }, speed, "swing");
return false;
});
});
/* tel_link */
if (navigator.userAgent.match(/(iPhone|Android)/)) {
jQuery(function ($) {
$(".tel_link").each(function () {
var str = $(this).html();
if ($(this).children().is("img")) {
$(this).html(
$("")
.attr("href", "tel:" + $(this).children().attr("alt").replace(/-|\s+/g, ""))
.append(str + "")
);
} else {
$(this).html(
$("")
.attr("href", "tel:" + $(this).text().replace(/-|\s+/g, ""))
.append(str + "")
);
}
});
});
}
$(function () {
$(".works__list").slick({
autoplay: true,
autoplaySpeed: 9000,
adaptiveHeight: true,
arrows: true,
slidesToShow: 2,
prevArrow: '',
nextArrow: '',
//レスポンシブでの動作を指定
responsive: [
{
breakpoint: 1400, //ブレイクポイントを指定
settings: {
arrows: false,
},
},
{
breakpoint: 768, //ブレイクポイントを指定
settings: {
autoplaySpeed: 9000,
slidesToShow: 1,
},
},
],
});
});