diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-10-25 16:28:36 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-10-25 16:29:53 +0200 |
| commit | d0271fcae88ceb10890d55f9a99424a174a93918 (patch) | |
| tree | 033ef1245d7905637c481512ed9a8fee0e37a956 /htdocs/src/js/app.js | |
| parent | 58f7b1be7c1ce366eabae3b172de732f0122776b (diff) | |
chore: hide the about project button on homepage
Diffstat (limited to 'htdocs/src/js/app.js')
| -rw-r--r-- | htdocs/src/js/app.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/htdocs/src/js/app.js b/htdocs/src/js/app.js index 636eb20..4260079 100644 --- a/htdocs/src/js/app.js +++ b/htdocs/src/js/app.js @@ -84,6 +84,20 @@ function listenMenuBtn() { } /** + * Show or hide the project details button depending on current location. + */ +function toggleProjectDetailsBtn() { + const button = document.querySelector('.btn--details'); + const currentPath = window.location.pathname; + + if (currentPath === '/') { + button.style.display = 'none'; + } else { + button.style.display = ''; + } +} + +/** * Update the visibility of some DOM elements depending on viewport. */ function updateView() { @@ -105,6 +119,8 @@ function updateView() { details?.classList.remove('hide'); details?.classList.add('fade-in'); } + + toggleProjectDetailsBtn(); } /** @@ -272,6 +288,7 @@ function getProjectsNavItem(id, name) { link.addEventListener('click', (e) => { e.preventDefault(); showProject(id, e.target.href); + toggleProjectDetailsBtn(); if (isSmallVw()) toggleHeaderFooter(); }); item.classList.add('nav__item'); |
