strokepule / script.js
roowoo's picture
increade the size of the floating particles by 10x and increase the speed by 3x
00f77e9 verified
// Particles.js initialization
document.addEventListener('DOMContentLoaded', function() {
if (typeof particlesJS !== 'undefined') {
particlesJS('particles-js', {
particles: {
number: { value: 30, density: { enable: true, value_area: 800 } },
color: { value: "#00B5D9" },
shape: { type: "circle" },
opacity: { value: 0.5, random: true },
size: { value: 30, random: true },
line_linked: { enable: false },
move: {
enable: true,
speed: 3,
direction: "none",
random: true,
straight: false,
out_mode: "out",
bounce: false
}
},
interactivity: {
detect_on: "canvas",
events: {
onhover: { enable: false },
onclick: { enable: false },
resize: true
}
}
});
}
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Intersection Observer for scroll animations
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fadeIn');
observer.unobserve(entry.target);
}
});
}, observerOptions);
document.querySelectorAll('.section-transition').forEach(section => {
observer.observe(section);
});
// Mobile menu toggle functionality (will be used by navbar component)
window.toggleMobileMenu = function() {
const menu = document.getElementById('mobile-menu');
menu.classList.toggle('hidden');
menu.classList.toggle('flex');
};
// Form submission handling
document.querySelectorAll('form').forEach(form => {
form.addEventListener('submit', function(e) {
e.preventDefault();
// Here you would typically handle form submission with fetch API
alert('Form submission would be handled here in a production environment.');
});
});