if ((navigator.userAgent.indexOf('iPhone') > 0) || (navigator.userAgent.indexOf('Android') > 0) && (navigator.userAgent.indexOf('Mobile') > 0)) { document.write(''); } else if (navigator.userAgent.indexOf('iPad') > 0) { document.write(''); } // var spW = 768, // winH; $(window).resize(function () { winH = window.innerHeight; }).trigger('resize'); function resizeHandler() { winW = $('html').css('overflow', 'hidden').width(); $('html').removeAttr('style'); winH = window.innerHeight; isChange = isSp !== undefined && isSp != (winW < spW); isSp = winW < spW; if (isSp && winW === currentWinW) { return; } } function initCommon() { $(window).resize(resizeHandler); resizeHandler(); currentWinW = $('html').css('overflow', 'hidden').width(); $('html').removeAttr('style'); $(window).scroll(function () { winScrollTop = $(window).scrollTop(); }).trigger('scroll'); } var spW = 900, // SP max width, not contain winW, // Window width currentWinW, winH, // Window height isSp, // Is SP or not isChange, // Is change to pc or sp winScrollTop; // Window scrollTop const disableBodyScroll = bodyScrollLock.disableBodyScroll; const enableBodyScroll = bodyScrollLock.enableBodyScroll; let $modalLink = $('.js-modalLink'); let $modal = $('.p-modal'); let $modalInner = $('.p-modal__inner'); let $modalCloseLink = $('.p-modal__close'); let $menuTrigger = $('.l-overMenuTrigger'); let $header = $('.l-header'); let $overMenu = $('.l-overMenu'); // YOUTUBE PLAYER var player; 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() { player = new YT.Player('youtubePlayer', { videoId: 'EgE7X5univw', events: { 'onReady': function (evt) { evt.target.mute(); evt.target.playVideo(); }, 'onStateChange': function (evt) { switch (evt.data) { case YT.PlayerState.ENDED: evt.target.playVideo(); break; } } }, playerVars: { rel: 0, playsinline: 1, } }); } function playVideo() { player.playVideo(); } function stopVideo() { player.stopVideo(); } $(function () { //page-scroller // $('a[href*=\\#]:not([href=\\#],.fancybox)').click(function () { // if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') // && location.hostname == this.hostname) { // var $target = $(this.hash); // $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); // if ($target.length) { // var targetOffset = $target.offset().top - $('header').height(); // $('html,body').animate({ scrollTop: targetOffset }, 1000); // return false; // } // } // }); //load animation $('.animsition').animsition({ inClass: 'fade-in', outClass: 'fade-out', inDuration: 1500, outDuration: 800, linkElement: '.fadeLink', // e.g. linkElement: 'a:not([target="_blank"]):not([href^="#"])' loading: true, loadingParentElement: 'body', //animsition wrapper element loadingClass: 'animsition-loading', loadingInner: '', // e.g '' timeout: false, timeoutCountdown: 5000, onLoadEvent: true, browser: ['animation-duration', '-webkit-animation-duration'], // "browser" option allows you to disable the "animsition" in case the css property in the array is not supported by your browser. // The default setting is to disable the "animsition" in a browser that does not support "animation-duration". overlay: false, overlayClass: 'animsition-overlay-slide', overlayParentElement: 'body', transition: function (url) { window.location.href = url; } }); window.onpageshow = function (event) { if (event.persisted) window.location.reload() }; $(window).on('load', function () { $modal.on('open', (e) => { $(e.currentTarget).css('opacity', 0).show().animate({ scrollTop: 0 }, { duration: 1 }).animate({ opacity: 1 }, 400); // $slider.autoplay.stop(); // playVideo() disableBodyScroll(e.currentTarget); }); $modal.on('close', (e) => { enableBodyScroll(e.currentTarget); // stopVideo(); // $slider.autoplay.start(); $(e.currentTarget).fadeOut(400); }); $modalLink.on('click', (e) => { const $target = $($(e.currentTarget).attr('href')); if ($target.length) { $target.trigger('open'); } return false; }); // $modal.on('click', (e) => { // $(e.currentTarget).trigger('close'); // }); $modalCloseLink.on('click', (e) => { const $target = $(e.currentTarget).parent(); if ($target.length) { $target.trigger('close'); } return false; }); $('.c-animate').on('inview', (e, isInView) => { if (isInView) { const $self = $(e.currentTarget); const delay = $self.data('delay') || 0; setTimeout(function () { $self.stop().addClass('__animated'); }, 500 + delay * 1.5); } }); $overMenu.on('open', (e) => { $overMenu.height(window.innerHeight); $header.addClass('l-header--menuOpen'); $menuTrigger.addClass('l-overMenuTrigger--open'); $overMenu.fadeIn(300); disableBodyScroll($overMenu.get(0)); }); $overMenu.on('close', (e) => { $header.removeClass('l-header--menuOpen'); $menuTrigger.removeClass('l-overMenuTrigger--open'); $overMenu.fadeOut(300); enableBodyScroll($overMenu.get(0)); }); $overMenu.find('.l-overMenu__item > a').on('click', (e) => { if ($(e.currentTarget).attr('href').match(/#/)) { $overMenu.trigger('close'); } }); $menuTrigger.on('click', (e) => { if ($overMenu.is(':visible')) { $overMenu.trigger('close'); } else { $overMenu.trigger('open'); } return false; }); $(window).on('resize', (e) => { $overMenu.height(window.innerHeight); }); }) //Fancybox function initFancybox() { $("[data-fancybox]").fancybox({ caption: null, // ★キャプション無効 buttons: ['close'], transitionDuration: 100, image: { preload: true, }, touch: false, loop: true, clickContent: function () { return false; }, mobile: { idleTime: false, clickContent: function () { return false; }, clickSlide: function () { return "close"; }, dblclickContent: function () { return "close"; }, dblclickSlide: function () { return "close"; } }, afterShow: function (instance, slide) { var url = instance.current.src; // 背景に画像を表示 $('.fancybox-bg') .css('background', 'url("' + url + '") no-repeat center center') .css('backgroundSize', 'cover'); // ★ 画像が見えない問題の対策 $('.fancybox-stage').css('transform', ''); // 位置ズレ修正 $('.fancybox-content').css('opacity', 1); // 非表示対策 } }); } initCommon(); initFancybox(); }); document.addEventListener('DOMContentLoaded', () => { /* ========================= アニメーション(IntersectionObserver) ========================= */ const targets = document.querySelectorAll('.c-animate'); if (targets.length) { const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('is-active'); observer.unobserve(entry.target); } }); }, { root: null, rootMargin: '0px 0px -10% 0px', threshold: 0 }); targets.forEach(el => observer.observe(el)); } /* ========================= 全アンカー共通スクロール ========================= */ // document.querySelectorAll('a[href^="#"]').forEach(anchor => { // anchor.addEventListener('click', function (e) { // e.preventDefault(); // const target = document.querySelector(this.getAttribute('href')); // if (!target) return; // const header = document.querySelector('.l-header'); // 固定ヘッダー // const headerHeight = header ? header.offsetHeight : 0; // const targetPos = target.getBoundingClientRect().top + window.pageYOffset - headerHeight - 10; // const isMenuLink = this.closest('.l-overMenu'); // if (isMenuLink) { // closeMenu(); // setTimeout(() => { // window.scrollTo({ // top: targetPos, // behavior: 'smooth' // }); // }, 300); // } else { // window.scrollTo({ // top: targetPos, // behavior: 'smooth' // }); // } // }); // }); /* ========================= swiper ========================= */ let $planSlideSwiper = new Swiper('.p-plan__slide', { // slidesPerView: 'auto', centeredSlides: true, spaceBetween: 0, loop: true, autoHeight: true, on: { slideChangeTransitionEnd() { this.updateAutoHeight(); } }, loopAdditionalSlides: 2, slidesPerView: 1, pagination: { el: ".p-plan__slide__pagination", type: 'bullets', clickable: true, }, navigation: { nextEl: '.p-plan__slide__navigation--next', prevEl: '.p-plan__slide__navigation--prev', }, }); /* ========================= salon tab ========================= */ const tabs = document.querySelectorAll('.p-salonTab'); const contents = document.querySelectorAll('.p-salonTab-content'); const wrapper = document.querySelector('.p-salonTab-content-wrapper'); // 初期高さセット wrapper.style.height = document.querySelector('.p-salonTab-content.active').offsetHeight + 'px'; tabs.forEach(tab => { tab.addEventListener('click', () => { const target = tab.dataset.tab; tabs.forEach(t => t.classList.remove('active')); tab.classList.add('active'); contents.forEach(content => { content.classList.remove('active'); if (content.id === target) { content.classList.add('active'); // ★ここが重要:wrapper の高さを更新 wrapper.style.height = content.offsetHeight + 'px'; } }); }); }); /* ========================= more read ========================= */ // SP幅のみ発動 if (window.innerWidth > spW) { return; } const readmoreBlocks = document.querySelectorAll('.p-venueReadmore-block, .p-dressReadmore-block'); readmoreBlocks.forEach(block => { const btnMore = block.querySelector('.p-venueReadmore-toggle') || block.querySelector('.p-dressReadmore-toggle'); const btnClose = block.querySelector('.p-venueReadmore-close') || block.querySelector('.p-dressReadmore-close'); if (!btnMore || !btnClose) return; const area = block.closest('.c-container'); // MORE btnMore.addEventListener('click', () => { area.classList.add('is-open'); }); // CLOSE btnClose.addEventListener('click', () => { area.classList.remove('is-open'); }); }); }); document.addEventListener('click', function (e) { const link = e.target.closest('a[href^="#"]'); if (!link) return; const href = link.getAttribute('href'); const target = document.querySelector(href); if (!target) return; e.preventDefault(); // 画面幅でヘッダー高さを切り替え const headerHeight = window.innerWidth <= 900 ? 50 : 65; // iOS Safari 対策:2フレーム待ってから位置計算 requestAnimationFrame(() => { requestAnimationFrame(() => { const targetPos = target.getBoundingClientRect().top + window.pageYOffset - headerHeight; window.scrollTo({ top: targetPos, behavior: 'smooth' }); }); }); }); window.addEventListener('load', () => { swiper.updateAutoHeight(); });