[call-me] - fix tooltip

This commit is contained in:
Miroslav Pejic
2025-01-05 22:17:51 +01:00
parent b155fa4d0d
commit 63431f2273
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -170,12 +170,20 @@ async function fetchRandomImage() {
}
}
// Initialize tooltips
// Initialize tooltips and handle hiding them when clicked
function handleToolTip() {
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="tooltip"]'));
const tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
// Add click event listener to hide all tooltips
tooltipTriggerList.forEach(function (tooltipTriggerEl) {
tooltipTriggerEl.addEventListener('click', function () {
tooltipList.forEach(function (tooltip) {
tooltip.hide(); // Hide all tooltips
});
});
});
}
// Handle localStorage data