var _ready=function(){ Array.prototype.forEach.call(document.querySelectorAll('[data-lib="4192"]'),function(element){ var timeoutId ; window.addEventListener( "scroll", function () { // スクロールを停止して500ms後に終了とする clearTimeout( timeoutId ) ; let target = document.getElementById("foot_fixed"); target.classList.remove("appear");//class名削除 timeoutId = setTimeout( function () { let target = document.getElementById("foot_fixed"); target.classList.add("appear");//class名追加 }, 500 ) ; } ) ; window.onload = function() { if( !sessionStorage.getItem('disp_popup') ) { sessionStorage.setItem('disp_popup', 'on'); let popup = document.getElementById("foot_fixed"); popup.classList.add("first"); } } window.addEventListener('load', function(){ var btnVol = document.querySelectorAll('.pay_btn').length; var btNum = parseInt(btnVol); var layoutNum = 'btn_layout' + btnVol; var btnLayout = document.getElementById('btnLayout'); btnLayout.classList.add(layoutNum); var pay_btn_empty = document.querySelectorAll('.pay_btn_empty').length; if(btnVol === 5 || btnVol ===7 || btnVol === 11){ document.getElementById('empty2').classList.remove('off'); } else if (btnVol === 10){ document.getElementById('empty1').classList.remove('off'); document.getElementById('empty2').classList.remove('off'); } if(btnVol === 3 || btnVol === 2){ var pay = document.getElementsByClassName('pay_btn_img'); [].forEach.call(pay, function(elem) { elem.classList.add('off'); }); var pay2 = document.getElementsByClassName('pay_btn_img2'); [].forEach.call(pay2, function(elem) { elem.classList.remove('off'); }); } if(btnVol <= 2){ var bottomdisc = document.getElementById('bottomDisc'); bottomdisc.classList.remove("off"); } }); });Array.prototype.forEach.call(document.querySelectorAll('[data-lib="14282"]'),function(element){ function showElementAnimation() { var element = document.getElementsByClassName('-w-anima-fade'); if(!element) return; var showTiming = window.innerHeight > 768 ? 200 : 40; var scrollY = window.pageYOffset; var windowH = window.innerHeight; for(var i=0;i elemY) { element[i].classList.add('-w-is-show'); } else if(scrollY + windowH < elemY) { element[i].classList.remove('-w-is-show'); } } } showElementAnimation(); window.addEventListener('scroll', showElementAnimation); });/*layout:25*/ /*ページ内リンク*/ let headH = document.getElementById('-w-header').offsetHeight; document.body.style.marginTop = headH + "px"; //CSSの調整部分。   /** * スムーススクロール実行関数 */ let smoothScroll = function(target, offset){ let toY; let nowY = window.pageYOffset; //現在のスクロール値 const divisor = 8; //近づく割合(数値が大きいほどゆっくり近く) const range = (divisor / 2) + 1; //どこまで近づけば処理を終了するか(無限ループにならないように divisor から算出) //ターゲットの座標 const targetRect = target.getBoundingClientRect(); //ターゲットの座標取得 const targetY = targetRect.top + nowY - offset; //現在のスクロール値 & ヘッダーの高さを踏まえた座標 //スクロール終了まで繰り返す処理 (function () { let thisFunc = arguments.callee; //自身を呼び出すために変数に代入 toY = nowY + Math.round((targetY - nowY) / divisor); //次に移動する場所(近く割合は除数による。) window.scrollTo(0, toY); //スクロールさせる nowY = toY; //nowY更新 if (document.body.clientHeight - window.innerHeight < toY) { //最下部にスクロールしても対象まで届かない場合は下限までスクロールして強制終了 window.scrollTo(0, document.body.clientHeight); return; } if (toY >= targetY + range || toY <= targetY - range) { //+-rangeの範囲内へ近くまで繰り返す window.setTimeout(thisFunc, 10); } else { //+-range の範囲内にくれば正確な値へ移動して終了。 window.scrollTo(0, targetY); } })(); }; /** * アンカータグにクリックイベントを登録 */ const smoothOffset = headH; //Fixされているヘッダーの高さ分スクロール先の座標をずらすために、変数に高さを入れておく const links = document.querySelectorAll('a[href*="#"]'); //#がリンクに含まれているアンカータグを全て取得 for (let i = 0; i < links.length; i++) { links[i].addEventListener('click', function (e) { const href = e.currentTarget.getAttribute('href'); //href取得 const splitHref = href.split('#'); const targetID = splitHref[1]; const target = document.getElementById(targetID); //リンク先の要素(ターゲット)取得 if (target) { smoothScroll(target, smoothOffset); } else { return true; } return false; }); } (function() { var duration = 800; var ignore = '.noscroll'; var easing = function (t, b, c, d) { return c * (0.5 - Math.cos(t / d * Math.PI) / 2) + b; }; //jswing var smoothScrollElm = document.querySelectorAll('a[href^="#"]:not(' + ignore +')'); Array.prototype.forEach.call(smoothScrollElm, function(elm) { elm.addEventListener('click', function(e) { e.preventDefault(); var targetElm = document.querySelector(elm.getAttribute('href')); if(!targetElm) return; var targetPos = targetElm.getBoundingClientRect().top; var startTime = Date.now(); var scrollFrom = scrollElm.scrollTop; (function loop() { var currentTime = Date.now() - startTime; if(currentTime < duration) { scrollTo(0, easing(currentTime, scrollFrom, targetPos, duration)); window.requestAnimationFrame(loop); } else { scrollTo(0, targetPos + scrollFrom); } })(); }) }); })(); /*page*/ }; if (document.readyState !== 'loading') { _ready(); } else { document.addEventListener('DOMContentLoaded', _ready, false); }