diff options
author | Robby Zambito <contact@robbyzambito.me> | 2025-07-29 19:11:55 -0400 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2025-07-29 19:12:42 -0400 |
commit | 6b0750dff33e505b730f94871f28ed1fbb8bcd21 (patch) | |
tree | db47e384bed295531b0140924ece242684dd8706 | |
parent | 198bef2c4a13c724d74967e263b9ca41a3abfa48 (diff) |
Fixed issue with broken span
Promt to Kagi Code:
The text rendered at the start seems to not properly handle the span. See the included screenshot.
-rw-r--r-- | static/script.js | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/static/script.js b/static/script.js index e1fd02c..6a833fe 100644 --- a/static/script.js +++ b/static/script.js @@ -65,7 +65,6 @@ document.querySelector('.contact-form').addEventListener('submit', function(e) { e.preventDefault(); // Get form data - const formData = new FormData(this); const name = this.querySelector('input[type="text"]').value; const email = this.querySelector('input[type="email"]').value; const message = this.querySelector('textarea').value; @@ -91,27 +90,6 @@ document.querySelector('.contact-form').addEventListener('submit', function(e) { }, 2000); }); -// Add typing animation to hero title -const heroTitle = document.querySelector('.hero-title'); -if (heroTitle) { - const text = heroTitle.innerHTML; - heroTitle.innerHTML = ''; - - let i = 0; - const typeWriter = () => { - if (i < text.length) { - heroTitle.innerHTML += text.charAt(i); - i++; - setTimeout(typeWriter, 50); - } - }; - - // Start typing animation after page load - window.addEventListener('load', () => { - setTimeout(typeWriter, 500); - }); -} - // Parallax effect for floating cards window.addEventListener('scroll', () => { const scrolled = window.pageYOffset; @@ -124,6 +102,46 @@ window.addEventListener('scroll', () => { }); }); +// Hero title fade-in animation +window.addEventListener('load', () => { + const heroTitle = document.querySelector('.hero-title'); + const heroSubtitle = document.querySelector('.hero-subtitle'); + const heroButtons = document.querySelector('.hero-buttons'); + + if (heroTitle) { + heroTitle.style.opacity = '0'; + heroTitle.style.transform = 'translateY(30px)'; + heroTitle.style.transition = 'opacity 0.8s ease, transform 0.8s ease'; + + setTimeout(() => { + heroTitle.style.opacity = '1'; + heroTitle.style.transform = 'translateY(0)'; + }, 300); + } + + if (heroSubtitle) { + heroSubtitle.style.opacity = '0'; + heroSubtitle.style.transform = 'translateY(30px)'; + heroSubtitle.style.transition = 'opacity 0.8s ease, transform 0.8s ease'; + + setTimeout(() => { + heroSubtitle.style.opacity = '1'; + heroSubtitle.style.transform = 'translateY(0)'; + }, 500); + } + + if (heroButtons) { + heroButtons.style.opacity = '0'; + heroButtons.style.transform = 'translateY(30px)'; + heroButtons.style.transition = 'opacity 0.8s ease, transform 0.8s ease'; + + setTimeout(() => { + heroButtons.style.opacity = '1'; + heroButtons.style.transform = 'translateY(0)'; + }, 700); + } +}); + // Add mobile menu styles dynamically const style = document.createElement('style'); style.textContent = ` |