DevlinDecatur/rubric-infographic-wizard
0
1document.addEventListener('DOMContentLoaded', function() {2 // Initialize tooltips3 const tooltipElements = document.querySelectorAll('[data-tooltip]');4 5 tooltipElements.forEach(el => {6 const tooltipText = el.getAttribute('data-tooltip');7 const tooltip = document.createElement('div');8 tooltip.className = 'hidden absolute z-50 bg-gray-900 text-white text-xs rounded py-1 px-2';9 tooltip.textContent = tooltipText;10 el.appendChild(tooltip);11 12 el.addEventListener('mouseenter', () => {13 tooltip.classList.remove('hidden');14 tooltip.classList.add('block');15 });16 17 el.addEventListener('mouseleave', () => {18 tooltip.classList.remove('block');19 tooltip.classList.add('hidden');20 });21 });22 23 // Smooth scrolling for anchor links24 document.querySelectorAll('a[href^="#"]').forEach(anchor => {25 anchor.addEventListener('click', function(e) {26 e.preventDefault();27 document.querySelector(this.getAttribute('href')).scrollIntoView({28 behavior: 'smooth'29 });30 });31 });32 33 // Print/download functionality34 const downloadBtn = document.querySelector('#download-btn');35 if (downloadBtn) {36 downloadBtn.addEventListener('click', () => {37 window.print();38 });39 }40});