Skip to content

Commit

Permalink
Create main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
buildplan authored Jul 5, 2024
1 parent 44d4690 commit ffabdb6
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions assets/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
document.getElementById('current-year').textContent = new Date().getFullYear();

const toggle = document.getElementById('dark-mode-toggle');
toggle.addEventListener('click', () => {
document.body.classList.toggle('dark-mode');
if (document.body.classList.contains('dark-mode')) {
toggle.classList.replace('fa-moon', 'fa-sun');
} else {
toggle.classList.replace('fa-sun', 'fa-moon');
}
});

// Show logo and animate box after ZETEO text animation
const letters = document.querySelectorAll('.letter');
const lastLetter = letters[letters.length - 1];
lastLetter.addEventListener('animationend', () => {
const logo = document.getElementById('logo');
const logoBox = document.getElementById('logo-box');

logo.style.opacity = 1;
logoBox.style.animation = 'drawBox 3s forwards';

// Add shimmer effect to the logo
logo.classList.add('shimmer');
});

// Hover effect for the logo container
const logoContainer = document.getElementById('logo-container');
logoContainer.addEventListener('mouseover', () => {
const logoBox = document.getElementById('logo-box');
logoBox.style.animation = 'rotateShimmer 2s infinite';
});
logoContainer.addEventListener('mouseout', () => {
const logoBox = document.getElementById('logo-box');
logoBox.style.animation = '';
});

0 comments on commit ffabdb6

Please sign in to comment.