From 205566eec93ca2504cadaaa1790136ad19282a00 Mon Sep 17 00:00:00 2001 From: yuki540 Date: Thu, 19 Apr 2018 14:02:31 +0900 Subject: [PATCH] =?UTF-8?q?update:=20=E9=96=89=E3=81=98=E3=82=8B=E3=83=9C?= =?UTF-8?q?=E3=82=BF=E3=83=B3=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/app.js | 1 + src/scripts/lib/util.js | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/scripts/app.js b/src/scripts/app.js index 20cdb12..df34437 100644 --- a/src/scripts/app.js +++ b/src/scripts/app.js @@ -9,6 +9,7 @@ import './components/app.tag' // init util.setRingSize() util.bindNav() +util.bindCloseBtn() // loading util.startLoading(() => { diff --git a/src/scripts/lib/util.js b/src/scripts/lib/util.js index 027f9f0..a565519 100644 --- a/src/scripts/lib/util.js +++ b/src/scripts/lib/util.js @@ -10,6 +10,7 @@ const end_animation = document.querySelector('.end-animation') const end_animation__end = document.querySelector('.end-animation .window img') const top_page = document.querySelector('.top-page') const top_page__wrap = document.querySelector('.top-page .wrap') +const page_box = document.querySelector('.page-box') /** * 画像のプリロード @@ -68,7 +69,7 @@ export const setRingSize = () => { } /** - * ナビゲーションボタンホバー時のイベント監視 + * ナビゲーションボタンの各イベント監視 */ export const bindNav = () => { const navs = document.querySelectorAll('.top-page__global-nav a') @@ -84,6 +85,25 @@ export const bindNav = () => { nav.addEventListener('mouseout', e => { top_page.setAttribute('data-color', '') }) + + /* click ----------------------------------------------------- */ + nav.addEventListener('click', e => { + e.preventDefault() + const state = !(page_box.getAttribute('data-state') === 'true') + page_box.setAttribute('data-state', state) + }) + }) +} + +/** + * ページを閉じるボタンのイベント監視 + */ +export const bindCloseBtn = () => { + const close_btn = document.querySelector('.page-box__close-btn') + + close_btn.addEventListener('click', e => { + e.preventDefault() + page_box.setAttribute('data-state', 'false') }) }