Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
79 lines (64 loc) · 2.33 KB
/
Copy pathscript.js
File metadata and controls
79 lines (64 loc) · 2.33 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Navbar scroll effect
window.addEventListener('scroll', function() {
const navbar = document.querySelector('.navbar');
if (window.scrollY > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
// Reveal on scroll
window.addEventListener('scroll', reveal);
function reveal() {
const reveals = document.querySelectorAll('.reveal');
reveals.forEach(element => {
const windowHeight = window.innerHeight;
const elementTop = element.getBoundingClientRect().top;
const elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
element.classList.add('active');
}
});
}
// Trigger reveal on page load
reveal();
// Dropdown Enhancement
const dropdowns = document.querySelectorAll('.dropdown');
dropdowns.forEach(dropdown => {
dropdown.addEventListener('mouseenter', function() {
if (window.innerWidth >= 992) {
this.querySelector('.dropdown-menu').classList.add('fade-in');
}
});
});
// Smooth Scroll
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
const headerOffset = navbar.offsetHeight;
const elementPosition = target.offsetTop;
const offsetPosition = elementPosition - headerOffset;
window.scrollTo({
top: offsetPosition,
behavior: 'smooth'
});
}
});
});
});
// Hero section
document.addEventListener('DOMContentLoaded', () => {
// Dynamic text animation
const words = ['strategic growth', 'innovation', 'collaboration'];
const dynamicText = document.querySelector('.dynamic-text');
let wordIndex = 0;
setInterval(() => {
dynamicText.style.opacity = 0;
setTimeout(() => {
dynamicText.textContent = words[wordIndex];
dynamicText.style.opacity = 1;
wordIndex = (wordIndex + 1) % words.length;
}, 200);
}, 2000);
});