//タブレット PC縮小表示
$(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('');
}
});
//Typekit
(function(d) {
var config = {
kitId: 'snk2lmb',
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);
//ラジオボタン 表示・非表示
function checkradio( disp ) {
document.getElementById('other').style.display = disp;
}
//$(function () {
//if($('.BGblack').length >= 1){
//スマホFV アドレスバーの高さ除外
//var height = $(window).height(); // 画面の高さをpxで取得
//$('#target').css('height',height); // id="target"の要素に高さを設定
//$('.BGblack').css('opacity',1);
//}
//});
function videoStart(){
$('.BGblack .wrapper').css('display','block');
$('.BGblack footer').css('display','block');
video.play();
attachParallax();
}
function setHeight() {
let vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
}
var video = null;
if($('.BGblack').length >= 1){
// 1.関数の定義
function setHeight() {
let vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
}
// 2.初期化
//setTimeout(function(){
// setHeight();
// },1000);
// 3.ブラウザのサイズが変更された時・画面の向きを変えた時に再計算する
//window.addEventListener('resize', setHeight);
var $video_alea = $('#video-area');
var src = '';
if (matchMedia('(min-width: 769px)').matches) {
src = $video_alea.data('pc');
window.addEventListener('resize', setHeight);
} else {
src = $video_alea.data('sm');
}
var video_alea = document.getElementById('video-area');
video = document.createElement("video");
video.setAttribute('src', src);
// video.setAttribute('muted', 'muted');
video.muted = true;
// video.setAttribute('autoplay', 'autoplay');
video.setAttribute('loop', 'loop');
video.setAttribute('playsinline', 'playsinline');
video.pause(0);
video_alea.appendChild(video);
}
if($('.BGblack').length >= 1){
$(document).scroll(function(){
var t = $('.BGblack .wrapper').offset().top;
if(t <= $(document).scrollTop()){
$('#video-area').css({'visibility':'hidden'});
}
else{
$('#video-area').css({'visibility':'visible'});
}
});
}
//2nd 最初の読み込み
//$(window).on('load',function(){
// if( !$('body').hasClass('BGblack')){
// $('.white_fade').addClass('start');
// }
// else{
// setHeight();
// }
// });
$(window).on('load', function() {
if($('.BGblack').length >= 1){
setHeight();
videoStart();
$(".loading").addClass('is-active');
}
$('.white_fade').animate({'opacity':0},1000,function(){
$(this).remove();
});
});