(function () { $(function(){ let _windowH = 0, _st = 0; const memberLength_pc = document.querySelectorAll('#js-slideMember-pc .swiper-slide').length, memberLength_sp = document.querySelectorAll('#js-slideMember-sp .swiper-slide').length, reportLength = document.querySelectorAll('#js-reportSlide .swiper-slide').length, donoesLength = document.querySelectorAll('#js-donorsSlide .swiper-slide').length; //スムーススクロール $('a[href^="#"]').on("click", function() { let speed = 400; let href= $(this).attr("href"); if (href === "#") return; let target = $(href == "#" || href == "" ? 'html' : href); let position = target.offset().top; let navHeight = $('.header__wrap').outerHeight(); $('body,html').animate({scrollTop:position - navHeight}, speed); return false; }); //ハンバーガーメニュー $('#js-menubtn').on('click', function() { $(this).toggleClass('is-open'); if($(this).hasClass('is-open')) { $('.header__nav__inner').slideDown(); } else { $('.header__nav__inner').slideUp(); } }); $('.header__nav a').on('click', function() { $('#js-menubtn').trigger('click'); }); //メンバー紹介スライド if (memberLength_pc > 1) { const memberSlide = new Swiper('#js-slideMember-pc', { mousewheel: { forceToAxis: true, sensitivity: 3 }, pagination: { el: '#js-slideMember-pc .swiper-pagination', clickable: true }, breakpoints: { 768: { mousewheel: { forceToAxis: false } } } }); } if (memberLength_sp > 1) { const memberSlide = new Swiper('#js-slideMember-sp', { mousewheel: { forceToAxis: true, sensitivity: 3 }, pagination: { el: '#js-slideMember-sp .swiper-pagination', clickable: true } }); } //活動報告スライド if (reportLength > 1) { const reportSlide = new Swiper('#js-reportSlide', { loop: true, effect: 'fade', speed: 1000, autoplay: { delay: 4000, disableOnInteraction: false, waitForTransition: false, }, pagination: { el: '#js-reportSlide .swiper-pagination', clickable: true } }); } //寄付者からのメッセージスライド if (donoesLength > 1) { const donorsSlide = new Swiper('#js-donorsSlide', { mousewheel: { forceToAxis: true, sensitivity: 3 }, pagination: { el: '#js-donorsSlide .swiper-pagination', clickable: true }, breakpoints: { 768: { mousewheel: { forceToAxis: false } } } }); } //パートナー「view more」ボタン $('#js-partnerMorebtn').on('click', function() { $(this).toggleClass('is-open'); $(this).prev('.list').slideToggle(); $(this).prev('.list').find('.img').toggleClass('is-show'); if($(this).hasClass('is-open')) { $(this).text('close'); } else { $(this).text('view more'); } }); $(window).on("resize", onResize); onResize(); $(window).on("scroll", onScroll); onScroll(); function onResize() { _windowH = $(window).height(); } function onScroll() { let _documentH = $(document).innerHeight(), _pageB = _documentH - _windowH; _st = $(window).scrollTop(); //「寄付する」ボタンフッターで非表示 if(_pageB <= _st) { $('.fixed-cta').addClass('is-hidden'); } else { $('.fixed-cta').removeClass('is-hidden'); } //アニメーション $('.n-sf-wrap').each(function () { if ($(this).offset().top - _windowH + _windowH * 0.16 <= _st) { $(this).addClass('n-sf-show'); } }); } var language = window.navigator.userLanguage || window.navigator.language; function getSearchParams(k) { var p = {}; location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (s, k, v) { p[k] = v; }); return k ? p[k] : p; } var x = getSearchParams('lang'); if (language == 'ja') { if (!x) { window.location.href = window.location.origin + "/2024shapethefutureproject/index.html?lang=1"; } } else { if (!x) { window.location.href = window.location.origin + "/2024shapethefutureproject/en/index.html?lang=2"; } } }); }());