Public Access
1
0

smooth scroll homepage link

This commit is contained in:
2025-08-06 23:01:44 -04:00
parent 8d9245af94
commit fd2b500ebb

View File

@@ -16,8 +16,9 @@ let isDeleting = false;
function type() {
const currentText = text.substring(0, index);
if (typewriterElement) {
typewriterElement.textContent = currentText;
}
if (!isDeleting && index < text.length) {
index++;
setTimeout(type, 100);
@@ -28,7 +29,9 @@ function type() {
// Start typing effect on load
document.addEventListener('DOMContentLoaded', () => {
if (typewriterElement) {
setTimeout(type, 500);
}
});
// Smooth scrolling for anchor links
@@ -56,3 +59,18 @@ document.querySelectorAll('a[href^="/#"]').forEach(anchor => {
}
});
});
// Smooth scrolling for the main home link
document.querySelectorAll('a[href="/"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
// If we are already on the homepage
if (window.location.pathname === '/') {
e.preventDefault(); // Prevent the page from reloading
// Scroll smoothly to the top of the page
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
});
});