MediaWiki:Common.js: Difference between revisions
Blanked the page Tags: Blanking Manual revert |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
document.querySelectorAll('.tooltip-cell').forEach(cell => { | |||
const tooltip = cell.querySelector('.tooltip-text'); | |||
cell.addEventListener('mouseenter', (event) => { | |||
// Get the cell's position relative to the viewport | |||
const rect = cell.getBoundingClientRect(); | |||
// Position the tooltip based on cell position | |||
tooltip.style.position = 'fixed'; | |||
tooltip.style.top = `${rect.top - 10}px`; // Position a bit above the cell | |||
tooltip.style.left = `${rect.right + 10}px`; // Position to the right of the cell | |||
tooltip.style.visibility = 'visible'; | |||
tooltip.style.opacity = '1'; | |||
tooltip.style.zIndex = '10000'; // Ensure tooltip appears above everything | |||
}); | |||
cell.addEventListener('mouseleave', () => { | |||
tooltip.style.visibility = 'hidden'; | |||
tooltip.style.opacity = '0'; | |||
}); | |||
}); |
Revision as of 19:39, 27 October 2024
document.querySelectorAll('.tooltip-cell').forEach(cell => { const tooltip = cell.querySelector('.tooltip-text'); cell.addEventListener('mouseenter', (event) => { // Get the cell's position relative to the viewport const rect = cell.getBoundingClientRect(); // Position the tooltip based on cell position tooltip.style.position = 'fixed'; tooltip.style.top = `${rect.top - 10}px`; // Position a bit above the cell tooltip.style.left = `${rect.right + 10}px`; // Position to the right of the cell tooltip.style.visibility = 'visible'; tooltip.style.opacity = '1'; tooltip.style.zIndex = '10000'; // Ensure tooltip appears above everything }); cell.addEventListener('mouseleave', () => { tooltip.style.visibility = 'hidden'; tooltip.style.opacity = '0'; }); });