From c644125354cd59c1505467329bc4c01d81931362 Mon Sep 17 00:00:00 2001 From: yuki540 Date: Wed, 18 Apr 2018 17:49:42 +0900 Subject: [PATCH] =?UTF-8?q?update:=20=E3=83=8A=E3=83=93=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E3=83=9E=E3=82=A6=E3=82=B9=E3=82=A4=E3=83=99?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=92=E7=9B=A3=E8=A6=96=E3=81=99=E3=82=8B?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92=E5=AE=9F=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 | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/scripts/app.js b/src/scripts/app.js index 1969132..20cdb12 100644 --- a/src/scripts/app.js +++ b/src/scripts/app.js @@ -8,6 +8,7 @@ import './components/app.tag' // init util.setRingSize() +util.bindNav() // loading util.startLoading(() => { diff --git a/src/scripts/lib/util.js b/src/scripts/lib/util.js index 52f5e23..ef26ecc 100644 --- a/src/scripts/lib/util.js +++ b/src/scripts/lib/util.js @@ -67,6 +67,26 @@ export const setRingSize = () => { top_page__wrap.style.transform = `scale(${ per })` } +/** + * ナビゲーションボタンホバー時のイベント監視 + */ +export const bindNav = () => { + const navs = document.querySelectorAll('.top-page__global-nav a') + + navs.forEach((nav, key) => { + /* mouseover ------------------------------------------------- */ + nav.addEventListener('mouseover', e => { + const color = e.target.getAttribute('data-color') + top_page.setAttribute('data-color', color) + }) + + /* mouseout -------------------------------------------------- */ + nav.addEventListener('mouseout', e => { + top_page.setAttribute('data-color', '') + }) + }) +} + /** * ロードの開始タイミングを取得 * @param fn : コールバック関数