Spaces:
Running

medisync-pulse / script.js
Couca's picture
Utilises ces couleurs et spécification :
69eac06 verified
Raw History Blame Contribute Delete
2.04 kB
// Initialize tooltips
document.addEventListener('DOMContentLoaded', function() {
const tooltipElements = document.querySelectorAll('[data-tooltip]');
tooltipElements.forEach(element => {
element.addEventListener('mouseenter', function() {
const tooltipText = this.getAttribute('data-tooltip');
const tooltip = document.createElement('div');
tooltip.className = 'absolute z-50 px-3 py-2 text-sm text-white bg-gray-800 rounded-md shadow-lg';
tooltip.textContent = tooltipText;
const rect = this.getBoundingClientRect();
tooltip.style.top = `${rect.top - 40}px`;
tooltip.style.left = `${rect.left + rect.width / 2}px`;
tooltip.style.transform = 'translateX(-50%)';
tooltip.id = 'dynamic-tooltip';
document.body.appendChild(tooltip);
});
element.addEventListener('mouseleave', function() {
const tooltip = document.getElementById('dynamic-tooltip');
if (tooltip) {
tooltip.remove();
}
});
});
// Mock data for demo purposes
if (typeof localStorage !== 'undefined') {
if (!localStorage.getItem('healthData')) {
const mockData = {
heartRate: 72,
bloodPressure: '118/76',
oxygenLevel: 98,
appointments: [
{
doctor: 'Dr. Sarah Johnson',
type: 'Cardiology Consultation',
date: 'Tomorrow',
time: '10:30 AM'
},
{
doctor: 'Lab Test',
type: 'Blood Work & Analysis',
date: 'Jun 15',
time: '1:00 PM'
}
]
};
localStorage.setItem('healthData', JSON.stringify(mockData));
}
}
});