animate center box to show/hide it

This commit is contained in:
Gerome Matilla 2020-06-04 13:43:09 +08:00
parent ec4bb1cda1
commit 6ab4ad3193
5 changed files with 26 additions and 0 deletions

View File

@ -11,3 +11,15 @@
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#centeredBox {
opacity: 1;
z-index: 2;
transition: opacity var(--transition-speed),
z-index var(--transition-speed);
}
#centeredBox.hiddenBox {
opacity: 0 !important;
z-index: 0 !important;
}

View File

@ -231,6 +231,7 @@
<script src="js/weather-screen.js"></script>
<script src="js/weather-settings.js"></script>
<script src="js/web-menu.js"></script>
<script src="js/centered-box.js"></script>
<script src="js/mobile-swipe-event.js"></script>
<script src="js/mobile-swipe-callback.js"></script>
</body>

6
js/centered-box.js Normal file
View File

@ -0,0 +1,6 @@
var centeredBox = document.getElementById("centeredBox");
const toggleCenteredBox = () => {
centeredBox.classList.toggle('hiddenBox');
console.log('toggle center box');
}

View File

@ -255,5 +255,8 @@ const toggleWeatherScreen = () => {
showWeatherScreen();
}
// Toggle center box
toggleCenteredBox();
console.log('toggle weather screen');
}

View File

@ -215,6 +215,10 @@ const toggleWebMenu = () => {
// Show Web menu
showWebMenu();
}
// Toggle center box
toggleCenteredBox();
console.log('toggle web menu');
}