//ナビメニュー $(function() { var $win = $(window), $main = $('.l-main'), $nav = $('.js-fnav'), navHeight = $nav.outerHeight(), navPos = $nav.offset().top, fixedClass = 'is-fixed'; $win.on('load scroll', function() { var value = $(this).scrollTop(); if ( value > navPos ) { $nav.addClass(fixedClass); $main.css('margin-top', navHeight); } else { $nav.removeClass(fixedClass); $main.css('margin-top', '0'); } }); }); function scrambleDomReady( fn ) { if ( typeof fn !== 'function' ) { return; } if ( document.readyState === 'interactive' || document.readyState === 'complete' ) { return fn(); } document.addEventListener( 'DOMContentLoaded', fn, false ); } scrambleDomReady(function () { intrinsicRatioVideos.init(); function resetSideBarPosition() { $("#sidebar").css('right', $(".l-section__inner.l-wordpress.-main").css('margin-right')); } function resetSideRowPostHeight() { $(".js-match-height-row").each(function() { var maxHeight = 0; $(this).children('.js-match-height').each(function () { var h = $(this).outerHeight(true); if(h > maxHeight){ maxHeight = h; } }); $(this).height(maxHeight + 1) }); } resetSideBarPosition(); resetSideRowPostHeight(); $(window).resize(function () { resetSideBarPosition(); resetSideRowPostHeight(); }) }); $(function(){ var now = new Date(); var year = now.getFullYear(); $('#copyrightYear').html(year); }); $(function () { var posts = $('.p-cloumnWordpressBlock06__item.js-match-height'); var maxHeight = 0; posts.each(function () { var h = $(this).height(); if(h > maxHeight){ maxHeight = h; } }); posts.each(function () { $(this).height(maxHeight); }); }); $(function () { var $nav = $('.navDrawr'); var $navBtn = $('.navDrawrBtn'); var $speed = 300; var $navW = 500; //サブメニューを非表示に // $nav.find('.sub').hide(); $nav.find('.l-mainHeader__search').on('click' ,function() { // PC表示時(ハンバーガーボタン非表示時)のみにプルダウンを限定 if ($('.navDrawrBtn span').css('display') !== 'block'){ //li要素にhoverした時に.subがあれば実行する if( $(this).parents('.l-mainHeader__menu').find('.sub').length && !$nav.hasClass('open') ){ // $(this).find('.sub').fadeIn(500); // $('.l-mainHeader__search').toggleClass('openSub'); $('.l-mainHeader__searchWrap').toggleClass('fade'); // if (!$('.l-mainHeader__search').hasClass('openSub')) { // //class activeが無かったら // console.log('xxxxxx'); //// $(this).find('.sub').fadeOut(500); // } } } }); $('body').on('click', function (e) { var element = $(e.target); // if click on nav-bar's search icon: do nothing if (element.hasClass('l-mainHeader__searchBtn') || element.parents('.l-mainHeader__searchBtn').length) { return true; } // if click outside the dropdown search box: hide the dropdown if (!(element.hasClass('l-mainHeader__searchWrap') || element.parents('.l-mainHeader__searchWrap').length)) { $('.l-mainHeader__searchWrap').removeClass('fade'); } });// //hover時の挙動 $("#button_more").on('click', function () { var origin_height = $("#tag_list").attr('attr_height'); $("#button_more").css('display','none'); $("#button_less").css('display','block'); $("#tag_list").animate({ height: origin_height, }, 500, function() { }); }); $("#button_less").on('click', function () { $("#button_less").css('display','none'); $("#button_more").css('display','block'); $("#tag_list").animate({ height: "30", }, 500, function() { }); }); // $nav.find('li').hover(function(){ // // PC表示時(ハンバーガーボタン非表示時)のみにプルダウンを限定 // if ($('.navDrawrBtn span').css('display') !== 'block'){ // //li要素にhoverした時に.subがあれば実行する // if( $(this).find('.sub').length && !$nav.hasClass('open') ){ // $(this).find('.sub').slideDown(); // } // } // },function(){ // // PC表示時(ハンバーガーボタン非表示時)のみにプルダウンを限定 // if ($('.navDrawrBtn span').css('display') !== 'block'){ // if(!$nav.hasClass('open')) { // $(this).find('.sub').stop(true).hide(); // } // } // }); //ドロワーに関連した記述(PCでもドロワーが動作するようにtouchend→clickに変更) $('body').on('click','.navDrawrBtn span',function(){ drawerFunc(); }); $('body').on('click','.overlay',function(){ drawerFunc(); }); function drawerFunc(){ if( $('body').hasClass('menuOpen') ){ $('body').removeClass('menuOpen'); if($('header').hasClass('is-fixed') ){ $('.l-main').css('margin-top','60px'); } else { $('.l-main').css('margin-top','0'); } $nav.animate({left:-1*$navW},$speed,'swing'); $('.overlay').fadeOut($speed); }else{ $('body').addClass('menuOpen'); $('.l-main').css('margin-top','60px'); if(!$('.overlay').length){ $('#wrapper').prepend('
'); } $nav.animate({left:0},$speed,'swing'); $('.overlay').fadeIn($speed); } } }); intrinsicRatioVideos = { init: function () { this.makeFit(); window.addEventListener('resize', function () { this.makeFit(); }.bind(this)); }, makeFit: function () { document.querySelectorAll('iframe, object, video').forEach(function (video) { var ratio, iTargetWidth, container = video.parentNode; // Skip videos we want to ignore if (video.classList.contains('intrinsic-ignore') || video.parentNode.classList.contains('intrinsic-ignore')) { return true; } if (!video.dataset.origwidth) { // Get the video element proportions video.setAttribute('data-origwidth', video.width); video.setAttribute('data-origheight', video.height); } iTargetWidth = container.offsetWidth; // Get ratio from proportions ratio = iTargetWidth / video.dataset.origwidth; // Scale based on ratio, thus retaining proportions video.style.width = iTargetWidth + 'px'; var height = (video.dataset.origheight * ratio) + 'px' video.style.height = height; container.style.height = height; }); } };