Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hid tooltip text of Google Apps when apps list opens #254

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,31 +217,34 @@ window.addEventListener('DOMContentLoaded', async () => {
// ---------------------------end of weather stuff--------------------

// ------------------------Google App Menu-----------------------------------
const iconContainer = document.getElementById("iconContainer"); // Menu to toggle visibility
const tooltipText = googleAppsCont.querySelector(".tooltip-text"); // Tooltip text element
// Toggle menu when clicking on googleAppsCont
const iconContainer = document.getElementById("iconContainer");
const googleAppsCont = document.getElementById("googleAppsCont");

// Toggle menu and tooltip visibility
googleAppsCont.addEventListener("click", function (event) {
tooltipText.style.display = "none"; // Hide the tooltip text
if (iconContainer.style.display === 'none' || iconContainer.style.display === '') {
iconContainer.style.display = 'grid'; // Show menu
const isMenuVisible = iconContainer.style.display === 'grid';

// Toggle menu visibility
iconContainer.style.display = isMenuVisible ? 'none' : 'grid';

// Add or remove the class to hide the tooltip
if (!isMenuVisible) {
googleAppsCont.classList.add('menu-open'); // Hide tooltip
} else {
iconContainer.style.display = 'none'; // Hide menu
googleAppsCont.classList.remove('menu-open'); // Restore tooltip
}

// Reset tooltip visibility after a delay
setTimeout(() => {
tooltipText.style.display = ""; // Restore default display
}, 1500);
event.stopPropagation(); // Prevent click propagation
event.stopPropagation();
});

// Close menu when clicking outside
document.addEventListener("click", function (event) {
if (iconContainer.style.display === 'grid') {
const isClickInside = iconContainer.contains(event.target) || googleAppsCont.contains(event.target);
if (!isClickInside) {
iconContainer.style.display = 'none'; // Hide menu
}
const isClickInside =
iconContainer.contains(event.target) || googleAppsCont.contains(event.target);

if (!isClickInside && iconContainer.style.display === 'grid') {
iconContainer.style.display = 'none'; // Hide menu
googleAppsCont.classList.remove('menu-open'); // Restore tooltip
}
});
// ------------------------End of Google App Menu Setup-----------------------------------
Expand Down
26 changes: 10 additions & 16 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@
background-color: var(--accentLightTint-blue);
}

.whitishColor {
/* .whitishColor {
fill: var(--whitishColor-blue);
background-color: var(--whitishColor-blue);
}
} */

.strokecolor {
stroke: var(--darkColor-blue);
Expand Down Expand Up @@ -288,9 +288,9 @@ body {
color: rgba(255, 255, 255, 0.9);
text-align: center;
padding: 5px;
border-radius: 7px;
border-radius: 8px;
position: absolute;
top: 108%;
top: 120%;
/* Position below the icon */
left: 50%;
transform: translateX(-50%);
Expand All @@ -308,16 +308,10 @@ body {
opacity: 1;
}

/* Hide tooltip when menu is open */
.googleAppsCont:hover + .icon-container .tooltip-text {
visibility: hidden;
opacity: 0;
}

/* Hide tooltip when icon button is clicked */
.googleAppsCont.clicked .tooltip-text {
visibility: hidden;
opacity: 0;
/* Ensure tooltip remains hidden when menu is visible */
.menu-open .tooltip-text {
visibility: hidden !important;
opacity: 0 !important;
}

/* Separator Styling */
Expand Down Expand Up @@ -885,9 +879,9 @@ body {
}

/* Placeholder color when the condition is met */
#searchQ.darker-placeholder::placeholder {
/* #searchQ.darker-placeholder::placeholder {
color: #3c3c3c;
}
} */

.searchControls {
margin-left: 10px;
Expand Down