//順番に現れるフローの設定script
function delayScrollAnime() {
var time = 0.2; //遅延時間を増やす秒数の値
var value = time;
$(".delayScroll").each(function () {
var parent = this; //親要素を取得
var elemPos = $(this).offset().top; //要素の位置まで来たら
var scroll = $(window).scrollTop(); //スクロール値を取得
var windowHeight = $(window).height(); //画面の高さを取得
var childs = $(this).children(); //子要素を取得
if (scroll >= elemPos - windowHeight && !$(parent).hasClass("play")) {
//指定領域内にスクロールが入ったらまた親要素にクラスplayがなければ
$(childs).each(function () {
if (!$(this).hasClass("fadeUp")) {
//アニメーションのクラス名が指定されているかどうかをチェック
$(parent).addClass("play"); //親要素にクラス名playを追加
$(this).css("animation-delay", value + "s"); //アニメーション遅延のCSS animation-delayを追加し
$(this).addClass("fadeUp"); //アニメーションのクラス名を追加
value = value + time; //delay時間を増加させる
//全ての処理を終わったらplayを外す
var index = $(childs).index(this);
if (childs.length - 1 == index) {
$(parent).removeClass("play");
}
}
});
} else {
$(childs).removeClass("fadeUp"); //アニメーションのクラス名を削除
value = time; //delay初期値の数値に戻す
}
});
}
// 画面をスクロールをしたら動かしたい場合の記述
$(window).scroll(function () {
delayScrollAnime(); /* アニメーション用の関数を呼ぶ*/
}); // ここまで画面をスクロールをしたら動かしたい場合の記述
//webフォント用script
(function (d) {
var config = {
kitId: "rvh4rrl",
scriptTimeout: 3000,
async: true,
},
h = d.documentElement,
t = setTimeout(function () {
h.className = h.className.replace(/\bwf-loading\b/g, "") + " wf-inactive";
}, config.scriptTimeout),
tk = d.createElement("script"),
f = false,
s = d.getElementsByTagName("script")[0],
a;
h.className += " wf-loading";
tk.src = "https://use.typekit.net/" + config.kitId + ".js";
tk.async = true;
tk.onload = tk.onreadystatechange = function () {
a = this.readyState;
if (f || (a && a != "complete" && a != "loaded")) return;
f = true;
clearTimeout(t);
try {
Typekit.load(config);
} catch (e) {}
};
s.parentNode.insertBefore(tk, s);
})(document);
//マーカー用script
$(window).scroll(function () {
$(".m3p_book-present_booklist_highlight").each(function () {
let hit = $(this).offset().top;
let scroll = $(window).scrollTop();
let wHeight = $(window).height();
if (scroll > hit - wHeight + wHeight / 100) {
$(this).addClass("m3p_book-present_booklist_marker");
} else {
$(this).removeClass("m3p_book-present_booklist_marker");
}
});
});
//カウントダウンタイマーの設定script
// ▼ カウントダウンタイマーの設定
function CountdownTimer(elm, tl, mes) {
this.initialize.apply(this, arguments);
}
CountdownTimer.prototype = {
initialize: function (elm, tl, mes) {
this.elem = document.getElementById(elm);
this.tl = tl;
this.mes = mes;
},
countDown: function () {
var timer = "";
var today = new Date();
var day = Math.floor((this.tl - today) / (24 * 60 * 60 * 1000));
var hour = Math.floor(((this.tl - today) % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000));
var min = Math.floor(((this.tl - today) % (24 * 60 * 60 * 1000)) / (60 * 1000)) % 60;
var sec = (Math.floor(((this.tl - today) % (24 * 60 * 60 * 1000)) / 1000) % 60) % 60;
var me = this;
if (this.tl - today > 0) {
if (day) timer += '' + day + "日";
this.elem.innerHTML = timer;
tid = setTimeout(function () {
me.countDown();
}, 10);
} else {
this.elem.innerHTML = this.mes;
return;
}
},
addZero: function (num) {
return ("0" + num).slice(-2);
},
};
// ▼ 開始&終了日時の指定と日付の判別
function CDT() {
var myD = Date.now(); // 1970/1/1午前0時から現在までのミリ秒
var start = new Date("2026-03-16T00:00+09:00"); // 開始日時の指定
var myS = start.getTime(); // 1970/1/1午前0時からの開始日時までのミリ秒
var end = new Date("2026-04-30T23:59+09:00"); // 終了日時の指定
var myE = end.getTime(); // 1970/1/1午前0時から終了日時までのミリ秒
var lastD = new Date("2026-04-30T00:00"); // 最終日のAM0:00
// 今日が開始日前か期間中か終了日後かの判別
if (lastD <= myD && myE >= myD) {
var text = '本日最終日';
var tl = end;
} // 期間中
else if (myS <= myD && myE >= myD) {
var text = "キャンペーン終了まで";
var tl = end;
} // 期間中
else {
var text = "";
} // 終了日後
var timer = new CountdownTimer("cdt_date", tl, " 終了しました "); // 終了日後のテキスト
timer.countDown();
target = document.getElementById("cdt_txt");
target.innerHTML = text;
}
window.onload = function () {
CDT();
};