41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
// University Assistant - Main JS
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
// Smooth scrolling for anchor links
|
|
document.querySelectorAll('a.nav-link[href^="#"]').forEach(anchor => {
|
|
anchor.addEventListener('click', function (e) {
|
|
e.preventDefault();
|
|
const targetId = this.getAttribute('href');
|
|
const targetElement = document.querySelector(targetId);
|
|
if (targetElement) {
|
|
targetElement.scrollIntoView({
|
|
behavior: 'smooth'
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
// Activate feather icons
|
|
feather.replace();
|
|
|
|
// Simple fade-in animation for sections on scroll
|
|
const sections = document.querySelectorAll('.section');
|
|
const observer = new IntersectionObserver(entries => {
|
|
entries.forEach(entry => {
|
|
if (entry.isIntersecting) {
|
|
entry.target.style.opacity = 1;
|
|
entry.target.style.transform = 'translateY(0)';
|
|
}
|
|
});
|
|
}, {
|
|
threshold: 0.1
|
|
});
|
|
|
|
sections.forEach(section => {
|
|
section.style.opacity = 0;
|
|
section.style.transform = 'translateY(20px)';
|
|
section.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out';
|
|
observer.observe(section);
|
|
});
|
|
});
|