This commit is contained in:
		@@ -104,6 +104,31 @@ function toggleFilter() {
 | 
			
		||||
        filterMenu.className = filterMenu.className + " hidden"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
// Smooth scrolling function for anchor links
 | 
			
		||||
function smoothScrollToElement(targetId) {
 | 
			
		||||
    const element = document.getElementById(targetId);
 | 
			
		||||
    if (element) {
 | 
			
		||||
        const headerHeight = document.getElementById('header-container') ? 
 | 
			
		||||
            document.getElementById('header-container').offsetHeight : 80;
 | 
			
		||||
        const elementPosition = element.offsetTop - headerHeight - 20;
 | 
			
		||||
        
 | 
			
		||||
        window.scrollTo({
 | 
			
		||||
            top: elementPosition,
 | 
			
		||||
            behavior: 'smooth'
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Handle anchor link clicks
 | 
			
		||||
function handleAnchorClick(event, link) {
 | 
			
		||||
    const href = link.getAttribute('href');
 | 
			
		||||
    if (href && href.startsWith('#')) {
 | 
			
		||||
        event.preventDefault();
 | 
			
		||||
        const targetId = href.substring(1);
 | 
			
		||||
        smoothScrollToElement(targetId);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
window.onload = function () {
 | 
			
		||||
    let elements = document.getElementsByTagName("button");
 | 
			
		||||
    let buttons = [...elements]
 | 
			
		||||
@@ -126,8 +151,18 @@ window.onload = function () {
 | 
			
		||||
        if (!internal_hosts.includes(links[i].hostname)) {
 | 
			
		||||
            links[i].target = '_blank';
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        // Add smooth scrolling for anchor links
 | 
			
		||||
        if (links[i].getAttribute('href') && links[i].getAttribute('href').startsWith('#')) {
 | 
			
		||||
            links[i].addEventListener('click', function(event) {
 | 
			
		||||
                handleAnchorClick(event, this);
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Add smooth scrolling behavior to html element
 | 
			
		||||
    document.documentElement.style.scrollBehavior = 'smooth';
 | 
			
		||||
 | 
			
		||||
    document.getElementById("filter-btn").addEventListener('click', toggleFilter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user