// 投稿部分用 子要素がないdivを削除 $('#post-pdf').each( function(){ if(!($(this).attr('href'))){ (this).remove(); } }); $('#post-youtube').each( function(){ if(!($(this).attr('src'))){ (this).remove(); } }); $(".post-photo").each( function() { if( !($(this).has('img')).length ){ this.remove(); } }); /* TELボタン */ $(function() { var ua = navigator.userAgent; if (ua.indexOf('iPhone') < 0 && ua.indexOf('Android') < 0) { $('a[href^="tel:"]').css({ "cursor": "default", "text-decoration": "none", "opacity": "1"}).click(function (event) { event.preventDefault(); });} }); /* ナビゲーション */ $(function() { var $header = $('.header'); $('.header .navToggle').click(function(){ $header.toggleClass('open'); }); $('.hd-nav .li a').on('click', function () { $('.header').removeClass('open'); }); }); $(function() { $('.navbar-nav a').click(function(){ $('.navbar-toggler').toggleClass('collapsed'); $('.navbar-collapse').removeClass('show'); $(".navbar-toggler").attr('aria-expanded', false); }); }); $(function(){ $('a[href^="#"]').click(function(){ var speed = 500; var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top; $("html, body").animate({scrollTop:position}, speed, "swing"); return false; }); }); /* ページトップボタン固定化 */ $(document).ready(function(){ $(".btn-pagetop").hide(); $(window).on("scroll", function() { if ($(this).scrollTop() > 100) { $('.btn-pagetop').fadeIn(); } else { $('.btn-pagetop').fadeOut(); } scrollHeight = $(document).height(); scrollPosition = $(window).height() + $(window).scrollTop(); footHeight = $(".ft").innerHeight(); if ( scrollHeight - scrollPosition <= footHeight ) { $(".btn-pagetop").css({ "position":"absolute", "right":"15px", "bottom": footHeight, "z-index": "30", }); } else { $(".btn-pagetop").css({ "position":"fixed", "bottom": "10px", "right": "15px", "z-index": "100", }); } }); // トップへスムーススクロール $('.btn-pagetop a').click(function () { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); }); /* ウインドウリサイズ */ $(document).ready(function() { funcResize(); $(window).resize(function() { funcResize(); }); function funcResize() { var wid = $(window).width(); //画像の切替 if( window.innerWidth < 768 ){ $('.switch').each(function(){ $(this).attr("src",$(this).attr("src").replace('_pc', '_sp')); }); }else{ $('.switch').each(function(){ $(this).attr("src",$(this).attr("src").replace('_sp', '_pc')); }); } //sp_menu if( window.innerWidth < 1024 ){ $('.hd-nav').each(function(){ $(this).addClass('sp-nav').removeClass('pc-nav'); }); }else { $('.hd-nav').each(function(){ $(this).addClass('pc-nav').removeClass('sp-nav'); }); } }; }); /* object-fitをIEに対応 */ /*! npm.im/object-fit-images 3.2.4 */ var objectFitImages=function(){"use strict";function t(t,e){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='"+t+"' height='"+e+"'%3E%3C/svg%3E"}function e(t){if(t.srcset&&!p&&window.picturefill){var e=window.picturefill._;t[e.ns]&&t[e.ns].evaled||e.fillImg(t,{reselect:!0}),t[e.ns].curSrc||(t[e.ns].supported=!1,e.fillImg(t,{reselect:!0})),t.currentSrc=t[e.ns].curSrc||t.src}}function i(t){for(var e,i=getComputedStyle(t).fontFamily,r={};null!==(e=u.exec(i));)r[e[1]]=e[2];return r}function r(e,i,r){var n=t(i||1,r||0);b.call(e,"src")!==n&&h.call(e,"src",n)}function n(t,e){t.naturalWidth?e(t):setTimeout(n,100,t,e)}function c(t){var c=i(t),o=t[l];if(c["object-fit"]=c["object-fit"]||"fill",!o.img){if("fill"===c["object-fit"])return;if(!o.skipTest&&f&&!c["object-position"])return}if(!o.img){o.img=new Image(t.width,t.height),o.img.srcset=b.call(t,"data-ofi-srcset")||t.srcset,o.img.src=b.call(t,"data-ofi-src")||t.src,h.call(t,"data-ofi-src",t.src),t.srcset&&h.call(t,"data-ofi-srcset",t.srcset),r(t,t.naturalWidth||t.width,t.naturalHeight||t.height),t.srcset&&(t.srcset="");try{s(t)}catch(t){window.console&&console.warn("https://bit.ly/ofi-old-browser")}}e(o.img),t.style.backgroundImage='url("'+(o.img.currentSrc||o.img.src).replace(/"/g,'\\"')+'")',t.style.backgroundPosition=c["object-position"]||"center",t.style.backgroundRepeat="no-repeat",t.style.backgroundOrigin="content-box",/scale-down/.test(c["object-fit"])?n(o.img,function(){o.img.naturalWidth>t.width||o.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=c["object-fit"].replace("none","auto").replace("fill","100% 100%"),n(o.img,function(e){r(t,e.naturalWidth,e.naturalHeight)})}function s(t){var e={get:function(e){return t[l].img[e?e:"src"]},set:function(e,i){return t[l].img[i?i:"src"]=e,h.call(t,"data-ofi-"+i,e),c(t),e}};Object.defineProperty(t,"src",e),Object.defineProperty(t,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(t,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}function o(){function t(t,e){return t[l]&&t[l].img&&("src"===e||"srcset"===e)?t[l].img:t}d||(HTMLImageElement.prototype.getAttribute=function(e){return b.call(t(this,e),e)},HTMLImageElement.prototype.setAttribute=function(e,i){return h.call(t(this,e),e,String(i))})}function a(t,e){var i=!y&&!t;if(e=e||{},t=t||"img",d&&!e.skipTest||!m)return!1;"img"===t?t=document.getElementsByTagName("img"):"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var r=0;r { entries.forEach( entry => { if ( entry.isIntersecting ) { // 監視対象の条件を満たしたら .reveal を追加 entry.target.classList.add( 'reveal' ); } } ); } // 監視対象が到達したとみなす条件 const options = { rootMargin: '0px', threshold: 1.0, // [0-1] }; // 監視の内容、条件 const observer = new IntersectionObserver( showElements, options ); // 対象要素すべてについて監視を開始 textItems.forEach( text => { observer.observe( text ); } ); } )(); //タブ切り替え const tabItem = document.querySelectorAll('.outline-btn'); const tabContent = document.querySelectorAll('.tab-content'); for (let i = 0; i < tabItem.length; i++) { tabItem[i].addEventListener('click', tabToggle); } function tabToggle() { for (let i = 0; i < tabItem.length; i++) { tabItem[i].classList.remove('active'); } for (let i = 0; i < tabContent.length; i++) { tabContent[i].classList.remove('active'); } this.classList.add('active'); const aryTabs = Array.prototype.slice.call(tabItem); const index = aryTabs.indexOf(this); tabContent[index].classList.add('active'); }