-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinline_script_12.js
More file actions
71 lines (31 loc) · 1011 Bytes
/
inline_script_12.js
File metadata and controls
71 lines (31 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
let activeCard = null;
let timeoutId = null;
function toggleTooltip(card) {
// Close the previously active card's tooltip
if (activeCard && activeCard !== card) {
activeCard.classList.remove('active');
}
// Toggle the clicked card's tooltip
card.classList.toggle('active');
// Update the active card
activeCard = card.classList.contains('active') ? card : null;
// Reset the auto-hide timeout
if (activeCard) {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
if (activeCard) {
activeCard.classList.remove('active');
activeCard = null;
}
}, 30000); // 30 seconds
}
}
// Close tooltips when clicking outside
document.addEventListener('click', (event) => {
if (!event.target.closest('.visa-card')) {
if (activeCard) {
activeCard.classList.remove('active');
activeCard = null;
}
}
});