lielow1524/codecraft-tutorials-learn-by-doing
0
1// Smooth scrolling for anchor links2document.querySelectorAll('a[href^="#"]').forEach(anchor => {3 anchor.addEventListener('click', function (e) {4 e.preventDefault();5 document.querySelector(this.getAttribute('href')).scrollIntoView({6 behavior: 'smooth'7 });8 });9});10 11// Track tutorial progress12document.addEventListener('DOMContentLoaded', () => {13 // This would be replaced with actual progress tracking logic14 const progressFill = document.querySelector('.progress-fill');15 if (progressFill) {16 // Simulate 25% progress for demo purposes17 progressFill.style.width = '25%';18 }19});20 21// Initialize tooltips for code examples22document.addEventListener('DOMContentLoaded', () => {23 // This would be replaced with actual tooltip initialization24 const codeBlocks = document.querySelectorAll('pre code');25 codeBlocks.forEach(block => {26 block.addEventListener('click', () => {27 // Copy to clipboard functionality would go here28 console.log('Code copied to clipboard!');29 });30 });31});