How to Increase Lung Capacity
Pranayama Yoga: How to Increase Lung capacity
`; toc.insertAdjacentHTML('beforeend', html); }); document.addEventListener('DOMContentLoaded', function() { var leadText = document.querySelector('.table-of-contents-lead-text'); leadText.addEventListener('click', function() { closeTOC(); }); }); function closeTOC() { if (window.innerWidth < 992) { var contentsSections = document.querySelectorAll('.table-of-contents-section'); contentsSections.forEach(function(section) { section.classList.toggle('visible'); section.style.display = section.style.display === 'block' ? 'none' : 'block'; }); // Update the arrow rotation based on the first section's visibility var arrow = document.querySelector('.table-of-contents-lead-text > .arrow'); var firstSection = contentsSections[0]; if (firstSection.classList.contains('visible')) { arrow.style.transform = 'rotate(180deg)'; } else { arrow.style.transform = 'rotate(0deg)'; } } } document.addEventListener('DOMContentLoaded', function() { var stickyStart = toc.offsetTop; window.addEventListener('scroll', function() { if (window.pageYOffset > stickyStart) { toc.classList.add('sticky'); } else { toc.classList.remove('sticky'); } }); }); document.addEventListener('DOMContentLoaded', () => { setTimeout(function() { // Get all the anchor links const anchorLinks = document.querySelectorAll('.table-of-contents a[href^="#"]:not([href="#"])'); // Get all the target elements const targets = Array.from(anchorLinks).map((link) => { const id = link.getAttribute('href'); const targetElement = document.querySelector(id); return targetElement ? { element: targetElement, id } : null; }).filter(target => target !== null); for (const targetObj of targets) { const target = targetObj.element; const link = anchorLinks[targets.indexOf(targetObj)]; link.addEventListener("click", function (event) { event.preventDefault(); const scrollPosition = window.scrollY + target.getBoundingClientRect().top - 150; window.scrollTo({ top: scrollPosition, behavior: 'smooth' }); }); } // Create an IntersectionObserver instance const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { const target = targets.find(target => target.element === entry.target); if (target) { const link = document.querySelector(`a[href="${target.id}"]`); if (entry.isIntersecting) { link.classList.add('active'); } else { link.classList.remove('active'); } } }); }, { rootMargin: '0px', threshold: 0.1 // Change this value to adjust when the "active" class is added or removed }); // Observe the target elements targets.forEach((target) => { observer.observe(target.element); }); // Add active class on page load if a target is in the viewport window.addEventListener('load', () => { targets.forEach((target) => { const rect = target.element.getBoundingClientRect(); if (rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth)) { const link = document.querySelector(`a[href="${target.id}"]`); link.classList.add('active'); } }); }); }, 1000); });
Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest