fix searchbox switching problems

This commit is contained in:
Gerome Matilla 2020-06-06 07:31:43 +08:00
parent 35c932aa8f
commit c7cf0dcbec
5 changed files with 28 additions and 11 deletions

View File

@ -1,7 +1,5 @@
#searchBoxContainer {
background: #ff00ff;
width: auto;
height: auto;

View File

@ -53,7 +53,12 @@ const toggleDashboard = () => {
if (weatherScreen.classList.contains('showWeatherScreen')) {
console.log('weather screen is open, closing...');
hideWeatherScreen();
return
return;
} else if (searchBoxContainer.classList.contains('showSearchBox')) {
console.log('searchbox is open, closing...');
hideSearchBox();
} else if (webMenu.classList.contains('showWebMenu')) {
console.log('web menu is open, closing...');
hideWebMenu();

View File

@ -1,6 +1,5 @@
var searchBoxContainer = document.getElementById('searchBoxContainer');
var searchBox = document.getElementById('searchBox');
var searchBoxContainer = document.getElementById('searchBoxContainer');
var centeredBoxOverlay = document.getElementById('centeredBoxOverlay');
let searchBoxVisility = false;
@ -12,11 +11,19 @@ const showSearchBox = () => {
searchBox.focus();
searchBoxVisility = !searchBoxVisility;
// Toggle overlay
centeredBoxOverlay.classList.toggle('showOverlay');
}
const hideSearchBox = () => {
searchBoxContainer.classList.remove('showSearchBox');
// Toggle overlay
centeredBoxOverlay.classList.toggle('showOverlay');
searchBox.value = '';
searchBoxVisility = !searchBoxVisility;
}
@ -38,8 +45,5 @@ const toggleSearchBox = () => {
showSearchBox();
}
// Show overlay
centeredBoxOverlay.classList.toggle('showOverlay');
console.log('toggle searchbox');
}

View File

@ -262,6 +262,11 @@ const toggleWeatherScreen = () => {
console.log('web menu is open, closing...');
hideWebMenu();
return;
} else if (searchBoxContainer.classList.contains('showSearchBox')) {
console.log('searchbox is open, closing...');
hideSearchBox();
} else if (dashboard.classList.contains('showRightDashboard')) {
console.log('dashboard is open, closing...');
hideDashboard();

View File

@ -224,7 +224,12 @@ const toggleWebMenu = () => {
if (weatherScreen.classList.contains('showWeatherScreen')) {
console.log('weather screen is open, closing...');
hideWeatherScreen();
return
return;
} else if (searchBoxContainer.classList.contains('showSearchBox')) {
console.log('searchbox is open, closing...');
hideSearchBox();
} else if (dashboard.classList.contains('showRightDashboard')) {
console.log('dashboard is open, closing...');
hideDashboard();