-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.js
More file actions
241 lines (221 loc) · 12.8 KB
/
Copy pathcontrol.js
File metadata and controls
241 lines (221 loc) · 12.8 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
// ═══ NAVBAR SCROLL ═══
const navbar = document.getElementById('navbar');
window.addEventListener('scroll', () => {
navbar.classList.toggle('scrolled', window.scrollY > 60);
});
// ═══ MOBILE MENU ═══
const hamburger = document.getElementById('hamburger');
const mobileMenu = document.getElementById('mobileMenu');
const mobileClose = document.getElementById('mobileClose');
hamburger.addEventListener('click', () => mobileMenu.classList.add('open'));
mobileClose.addEventListener('click', () => mobileMenu.classList.remove('open'));
function closeMobile() { mobileMenu.classList.remove('open'); }
// ═══ FADE IN ON SCROLL ═══
const fadeEls = document.querySelectorAll('.fade-in');
const observer = new IntersectionObserver((entries) => {
entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('visible'); observer.unobserve(e.target); } });
}, { threshold: 0.12 });
fadeEls.forEach(el => observer.observe(el));
// ═══ ABOUT CAROUSEL ═══
let carouselIdx = 0;
const track = document.getElementById('carouselTrack');
const slides = track.querySelectorAll('.carousel-slide');
const dotsContainer = document.getElementById('carouselDots');
slides.forEach((_, i) => {
const dot = document.createElement('div');
dot.className = 'carousel-dot' + (i === 0 ? ' active' : '');
dot.addEventListener('click', () => goCarousel(i));
dotsContainer.appendChild(dot);
});
function goCarousel(idx) {
carouselIdx = (idx + slides.length) % slides.length;
track.style.transform = `translateX(-${carouselIdx * 100}%)`;
dotsContainer.querySelectorAll('.carousel-dot').forEach((d, i) => d.classList.toggle('active', i === carouselIdx));
}
document.getElementById('carouselPrev').addEventListener('click', () => goCarousel(carouselIdx - 1));
document.getElementById('carouselNext').addEventListener('click', () => goCarousel(carouselIdx + 1));
setInterval(() => goCarousel(carouselIdx + 1), 4500);
// Touch swipe
let touchStartX = 0;
track.parentElement.addEventListener('touchstart', e => touchStartX = e.touches[0].clientX);
track.parentElement.addEventListener('touchend', e => {
const diff = touchStartX - e.changedTouches[0].clientX;
if (Math.abs(diff) > 50) goCarousel(diff > 0 ? carouselIdx + 1 : carouselIdx - 1);
});
// ═══ PRACTICE AREAS ═══
const practiceAreas = [
{ icon: 'fas fa-building', title: 'Corporate Law', desc: 'Expert counsel on company formation, mergers, acquisitions, shareholder agreements, and all aspects of corporate governance.' },
{ icon: 'fas fa-chart-line', title: 'Business Advisory', desc: 'Strategic legal and business advisory services to help organizations navigate challenges and capitalize on opportunities.' },
{ icon: 'fas fa-clipboard-check', title: 'Regulatory Compliance', desc: 'Ensuring your business meets all Nigerian regulatory requirements across industries, from finance to manufacturing.' },
{ icon: 'fas fa-file-signature', title: 'Company Secretarial', desc: 'Comprehensive company secretarial services including CAC filings, statutory registers, and corporate documentation.' },
{ icon: 'fas fa-home', title: 'Real Estate Law', desc: 'Full-service real estate legal support covering property acquisition, title verification, leases, and conveyancing.' },
{ icon: 'fas fa-key', title: 'Property Management', desc: 'Legal framework for property managers and landlords — tenancy agreements, dispute resolution, and regulatory compliance.' },
{ icon: 'fas fa-film', title: 'Entertainment & Media Law', desc: 'Protecting creative professionals through robust contracts, licensing agreements, and rights management strategies.' },
{ icon: 'fas fa-lightbulb', title: 'Intellectual Property', desc: 'Trademark, copyright, patent, and trade secret protection for businesses and creatives in the digital economy.' },
{ icon: 'fas fa-heart', title: 'Family Law', desc: 'Sensitive and strategic legal support for matrimonial matters, divorce, child custody, adoption, and estate planning.' },
{ icon: 'fas fa-fist-raised', title: 'Human Rights Law', desc: 'Advocacy for fundamental rights, constitutional freedoms, and justice for individuals and organizations.' },
{ icon: 'fas fa-gavel', title: 'Criminal Defense', desc: 'Vigorous criminal defense representation at all stages — from investigation through trial and appeals.' },
{ icon: 'fas fa-balance-scale-right', title: 'Commercial Litigation', desc: 'Strategic dispute resolution and representation in commercial litigation before Nigerian courts and arbitration panels.' },
];
const grid = document.getElementById('practiceGrid');
practiceAreas.forEach((p, i) => {
const card = document.createElement('div');
card.className = 'practice-card fade-in';
card.style.transitionDelay = `${(i % 4) * 0.1}s`;
card.innerHTML = `
<div class="practice-icon"><i class="${p.icon}"></i></div>
<h3>${p.title}</h3>
<p>${p.desc}</p>
<span class="learn-more">Learn More <i class="fas fa-arrow-right" style="font-size:0.7rem"></i></span>
`;
grid.appendChild(card);
});
// Re-observe new elements
grid.querySelectorAll('.fade-in').forEach(el => observer.observe(el));
// ═══ GALLERY ═══
const galleryImages = [
{ src: 'https://images.unsplash.com/photo-1521791136064-7986c2920216?w=600&q=80', cat: 'office', alt: 'Modern law office' },
{ src: 'https://images.unsplash.com/photo-1589829545856-d10d557cf95f?w=600&q=80', cat: 'legal', alt: 'Legal documents' },
{ src: 'https://images.unsplash.com/photo-1551836022-d5d88e9218df?w=600&q=80', cat: 'team', alt: 'Legal team' },
{ src: 'https://images.unsplash.com/photo-1450101499163-c8848c66ca85?w=600&q=80', cat: 'legal', alt: 'Contract review' },
{ src: 'https://images.unsplash.com/photo-1575505986919-2fa344efb05e?w=600&q=80', cat: 'courtroom', alt: 'Courtroom' },
{ src: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=600&q=80', cat: 'team', alt: 'Attorney portrait' },
{ src: 'https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?w=600&q=80', cat: 'team', alt: 'Legal professional' },
{ src: 'https://images.unsplash.com/photo-1560518883-ce09059eeffa?w=600&q=80', cat: 'events', alt: 'Legal event' },
{ src: 'https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?w=600&q=80', cat: 'office', alt: 'Office meeting' },
{ src: 'https://images.unsplash.com/photo-1568992688065-536aad8a12f6?w=600&q=80', cat: 'office', alt: 'Modern office interior' },
{ src: 'https://images.unsplash.com/photo-1504711434969-e33886168f5c?w=600&q=80', cat: 'events', alt: 'Law conference' },
{ src: 'https://images.unsplash.com/photo-1593115057322-e94b77572f20?w=600&q=80', cat: 'courtroom', alt: 'Court hall' },
{ src: 'https://images.unsplash.com/photo-1549924231-f129b911e442?w=600&q=80', cat: 'legal', alt: 'Legal books' },
{ src: 'https://images.unsplash.com/photo-1565514158740-064f34bd6cfd?w=600&q=80', cat: 'office', alt: 'Office desk' },
{ src: 'https://images.unsplash.com/photo-1521737711867-e3b97375f902?w=600&q=80', cat: 'team', alt: 'Team meeting' },
{ src: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=600&q=80', cat: 'events', alt: 'Award ceremony' },
//{ src: 'imgg.png', cat: 'events', alt: 'Award ceremony1' },
];
let activeFilter = 'all';
let lightboxIdx = 0;
let lightboxImages = [];
function getFiltered() {
return activeFilter === 'all' ? galleryImages : galleryImages.filter(g => g.cat === activeFilter);
}
function openLightbox(images, idx) {
lightboxImages = images;
lightboxIdx = idx;
updateLightbox();
document.getElementById('lightbox').classList.add('open');
document.body.style.overflow = 'hidden';
}
function updateLightbox() {
const img = lightboxImages[lightboxIdx];
document.getElementById('lightboxImg').src = img.src.replace('w=600', 'w=1200');
document.getElementById('lightboxCounter').textContent = `${lightboxIdx + 1} / ${lightboxImages.length}`;
}
document.getElementById('lightboxClose').addEventListener('click', () => {
document.getElementById('lightbox').classList.remove('open');
document.body.style.overflow = '';
});
document.getElementById('lightboxPrev').addEventListener('click', () => {
lightboxIdx = (lightboxIdx - 1 + lightboxImages.length) % lightboxImages.length;
updateLightbox();
});
document.getElementById('lightboxNext').addEventListener('click', () => {
lightboxIdx = (lightboxIdx + 1) % lightboxImages.length;
updateLightbox();
});
document.getElementById('lightbox').addEventListener('click', e => {
if (e.target === document.getElementById('lightbox')) {
document.getElementById('lightbox').classList.remove('open');
document.body.style.overflow = '';
}
});
document.addEventListener('keydown', e => {
if (!document.getElementById('lightbox').classList.contains('open')) return;
if (e.key === 'ArrowLeft') document.getElementById('lightboxPrev').click();
if (e.key === 'ArrowRight') document.getElementById('lightboxNext').click();
if (e.key === 'Escape') document.getElementById('lightboxClose').click();
});
function createGItem(img, idx, images, extraClass) {
const div = document.createElement('div');
div.className = 'g-item' + (extraClass ? ' ' + extraClass : '');
div.innerHTML = `
<img src="${img.src}" alt="${img.alt}" loading="lazy" />
<div class="g-item-overlay"><i class="fas fa-expand"></i></div>
`;
div.addEventListener('click', () => openLightbox(images, idx));
return div;
}
function buildGallery() {
const filtered = getFiltered();
const htrack = document.getElementById('galleryHTrack');
const masonry = document.getElementById('galleryMasonry');
htrack.innerHTML = '';
masonry.innerHTML = '';
filtered.forEach((img, i) => {
htrack.appendChild(createGItem(img, i, filtered));
masonry.appendChild(createGItem(img, i, filtered));
});
}
// Auto-scroll strip (duplicate for infinite loop)
const strip = document.getElementById('galleryStrip');
[...galleryImages, ...galleryImages].forEach((img, i) => {
const div = document.createElement('div');
div.className = 'g-strip-item';
div.innerHTML = `<img src="${img.src}" alt="${img.alt}" loading="lazy" />`;
div.addEventListener('click', () => openLightbox(galleryImages, i % galleryImages.length));
strip.appendChild(div);
});
buildGallery();
// Filter buttons
document.getElementById('galleryFilters').addEventListener('click', e => {
if (!e.target.classList.contains('filter-btn')) return;
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
e.target.classList.add('active');
activeFilter = e.target.dataset.cat;
buildGallery();
});
// Drag scroll for horizontal gallery
const hscroll = document.getElementById('galleryHScroll');
let isDragging = false, startX, scrollLeft;
hscroll.addEventListener('mousedown', e => { isDragging = true; startX = e.pageX - hscroll.offsetLeft; scrollLeft = hscroll.scrollLeft; hscroll.classList.add('grabbing'); });
hscroll.addEventListener('mouseleave', () => { isDragging = false; hscroll.classList.remove('grabbing'); });
hscroll.addEventListener('mouseup', () => { isDragging = false; hscroll.classList.remove('grabbing'); });
hscroll.addEventListener('mousemove', e => { if (!isDragging) return; e.preventDefault(); hscroll.scrollLeft = scrollLeft - (e.pageX - hscroll.offsetLeft - startX); });
// ═══ TESTIMONIALS SLIDER ═══
let tIdx = 0;
const tInner = document.getElementById('testimonialsInner');
const tCards = tInner.querySelectorAll('.testimonial-card');
const tDotsContainer = document.getElementById('sliderDots');
tCards.forEach((_, i) => {
const d = document.createElement('div');
d.className = 'slider-dot' + (i === 0 ? ' active' : '');
d.addEventListener('click', () => goTestimonial(i));
tDotsContainer.appendChild(d);
});
function goTestimonial(idx) {
tIdx = (idx + tCards.length) % tCards.length;
tInner.style.transform = `translateX(-${tIdx * 100}%)`;
tDotsContainer.querySelectorAll('.slider-dot').forEach((d, i) => d.classList.toggle('active', i === tIdx));
}
document.getElementById('tPrev').addEventListener('click', () => goTestimonial(tIdx - 1));
document.getElementById('tNext').addEventListener('click', () => goTestimonial(tIdx + 1));
setInterval(() => goTestimonial(tIdx + 1), 5000);
// ═══ CONTACT FORM ═══
function handleFormSubmit(e) {
e.preventDefault();
const btn = e.target.querySelector('button[type="submit"]');
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Sending...';
btn.disabled = true;
setTimeout(() => {
document.getElementById('formSuccess').style.display = 'block';
btn.innerHTML = 'Send Message <i class="fas fa-paper-plane"></i>';
btn.disabled = false;
e.target.reset();
}, 1800);
}
// ═══ SMOOTH SCROLL ═══
document.querySelectorAll('a[href^="#"]').forEach(a => {
a.addEventListener('click', e => {
const target = document.querySelector(a.getAttribute('href'));
if (target) { e.preventDefault(); target.scrollIntoView({ behavior: 'smooth', block: 'start' }); }
});
});