(function($, _, util, obj){ $(function(){ /*-------------------------------------------------*/ // デバイス判定 /*-------------------------------------------------*/ var isDevice = { 'mobile': true, 'run': function(){ if($(window).width() <= 1052) { //スマートフォン isDevice.mobile = true; }else{ //PC isDevice.mobile = false; } } } isDevice.run(); $(window).on('load resize', function(){ isDevice.run(); }); /*-------------------------------------------------*/ // スムーススクロール /*-------------------------------------------------*/ var smoothScroll = { 'adjust': function(){ if(isDevice.mobile){ return 55; }else{ return 84; } }, 'run': function(target, area){ if(isDevice.mobile){ headerMenu.close(); } if(area === 'modal'){ var scrollArea = $('.modal-wrap.isOpen'); }else{ var scrollArea = $('html,body'); } target = $(target); if(target.length === 0){ var targetPosY = 0; }else{ var targetPosY = target.offset().top; } // モーダルが開いている & ナビゲーションをクリック if(detailModal.state && area !== 'modal'){ detailModal.closeModal(); $('.page-wrap').removeClass('active'); //scroll setTimeout(function(){ $(scrollArea).animate({ scrollTop: targetPosY }, 800, 'swing'); },500); }else{ $(scrollArea).animate({ scrollTop: targetPosY - smoothScroll.adjust() }, 800, 'swing'); } } } $('[data-href]').on('click', function(){ var target = $(this).attr('data-href'); smoothScroll.run(target); return false; }); $('[modal-href]').on('click', function(){ var target = $(this).attr('modal-href'); smoothScroll.run(target, 'modal'); return false; }); /*-------------------------------------------------*/ // 追従メニュー01 /*-------------------------------------------------*/ var fixedHeader = { 'element': '', 'scrollbarwidth': window.innerWidth - $(window).width(), 'getHeader': function(){ if(isDevice.mobile){ fixedHeader.element = $('.anchors-panel.only-sp'); }else{ fixedHeader.element = $('.anchors-panel.only-pc'); } }, 'getTriggerPosY': function(){ return $('.kv-panel').offset().top + $('.kv-panel').height(); }, 'fixed': function(){ fixedHeader.element.addClass('isFixed'); $('.lead-panel').css({ 'margin-top': fixedHeader.element.outerHeight() }); }, 'removeFixed': function(){ if(isDevice.mobile){ if(fixedHeader.element.hasClass('isFixed')){ headerMenu.close(); } } fixedHeader.element.removeClass('isFixed'); $('.lead-panel').css({ 'margin-top': 0 }); }, 'run': function(currentPosX,currentPosY){ fixedHeader.getHeader(); if(fixedHeader.getTriggerPosY() <= currentPosY){ if(!fixedHeader.element.hasClass('isFixed')){ fixedHeader.fixed(); $('.lead-panel').css({ 'margin-top': fixedHeader.element.outerHeight() }); } }else{ if(fixedHeader.element.hasClass('isFixed')){ fixedHeader.removeFixed(); // fixedHeader.element.removeAttr('style'); fixedHeader.element.css('cssText','padding-left:0px!important;'); } } if(fixedHeader.element.hasClass('isFixed')){ fixedHeader.element.css('cssText','transform:translateX('+currentPosX*-1+'px);padding-left:'+0+'px!important;'); // fixedHeader.element.css('cssText','transform:translateX('+currentPosX*-1+'px);padding-left:'+fixedHeader.scrollbarwidth+'px!important;'); // fixedHeader.element.css({ // 'transform': 'translateX('+currentPosX*-1+'px)' // }); } } } $(window).on('load scroll resize', function(){ fixedHeader.run($(this).scrollLeft(),$(this).scrollTop()); }); /*-------------------------------------------------*/ /*-------------------------------------------------*/ var fixedHeader02 = { 'targetPosY': '', 'run': function(currentPosY){ var target = $('.anchors-voice-panel'); if(fixedHeader02.targetPosY <= currentPosY){ if(!target.hasClass('is-fixed')){ target.addClass('is-fixed'); } }else{ if(target.hasClass('is-fixed')){ target.removeClass('is-fixed'); } } } } $(window).on('load', function(){ fixedHeader02.targetPosY = $('.kv-panel').offset().top; }); $(window).on('load scroll resize', function(){ if(isDevice.mobile){ fixedHeader02.run($(this).scrollTop()); } }); /*-------------------------------------------------*/ // 追従メニューの現在地 /*-------------------------------------------------*/ var checkActive = { 'targets': { 'element': [], 'posY': [] }, 'pushValues': function(screenHeight){ var anchors = $('.anchors-panel.only-pc .list-anchors ul a'); checkActive.targets.element = []; checkActive.targets.posY = []; anchors.each(function(){ var target = $(this).data('href'); checkActive.targets.element.push(target); if(target !== '#'){ checkActive.targets.posY.push($(target).offset().top - (screenHeight * 0.4)); }else{ checkActive.targets.posY.push(0); } }); }, 'run': function(currentPosY){ var anchors = $('.anchors-panel.only-pc .list-anchors ul a'); for(var i = 0; i 640){ if(window.outerWidth > 640){ var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); function onYouTubeIframeAPIReady(){ ytPlayer = new YT.Player('js-movie', { height: 628, width: 1270, videoId: '1pg93KGXaJs', playerVars: { autoplay: 1, loop: 1, playlist: '1pg93KGXaJs', fs: 0, // フルスクリーンボタンを消す rel: 0, // 関連動画を非表示にする showinfo: 0, // インフォメーションを非表示にする controls: 0, // UIを非表示にする modestbranding: 1, // ロゴを非表示にする iv_load_policy: 3, // アノテーションを非表示にする playsinline: 1 }, events: { 'onReady': onPlayerReady // 'onPlaybackQualityChange': onPlaybackQualityChange // 'onStateChange': onPlayerStateChange } }); } function onPlayerReady(event) { event.target.mute(); event.target.setPlaybackQuality('small'); event.target.playVideo(); } }