Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
49 lines (42 loc) · 1.45 KB
/
Copy pathapp.js
File metadata and controls
49 lines (42 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Custom Cursor
const cursor = document.querySelector('.cursor');
document.addEventListener('mousemove', (e) => {
cursor.style.left = e.clientX + 'px';
cursor.style.top = e.clientY + 'px';
});
// Add grow effect on hover for text elements
document.querySelectorAll('a, h1, h2, h3, p, button, .service-card, .market-card').forEach(element => {
element.addEventListener('mouseenter', () => {
cursor.classList.add('grow');
});
element.addEventListener('mouseleave', () => {
cursor.classList.remove('grow');
});
});
// Smooth scroll for navigation
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Animation on scroll
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
document.querySelectorAll('.service-card, .market-card, .about-content > div').forEach(element => {
element.style.opacity = '0';
element.style.transform = 'translateY(50px)';
element.style.transition = 'all 0.6s ease';
observer.observe(element);
});