GhostPack / script.js
ghostai1's picture
Update script.js
a012e58 verified
// 👻 GhostPack Spectral Interactivity 😈
// Smooth scrolling
document.querySelectorAll('a.nav-link').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href').substring(1);
document.getElementById(targetId).scrollIntoView({ behavior: 'smooth' });
});
});
// Scroll reveal animations
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate__animated', 'animate__fadeInUp');
if (entry.target.classList.contains('card')) {
entry.target.classList.add('ghost-animation');
}
}
});
}, { threshold: 0.3 });
document.querySelectorAll('.card, h2, .lead, section').forEach(el => {
observer.observe(el);
});
// Neon glow on card hover
document.querySelectorAll('.card').forEach(card => {
card.addEventListener('mouseenter', () => {
card.style.transform = 'translateY(-12px) scale(1.05)';
card.style.boxShadow = '0 0 50px rgba(0, 255, 204, 0.9)';
});
card.addEventListener('mouseleave', () => {
card.style.transform = 'translateY(0) scale(1)';
card.style.boxShadow = '0 0 25px rgba(0, 255, 204, 0.5)';
});
});
// Enable tooltips
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));