-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
92 lines (80 loc) · 2.84 KB
/
Copy pathscript.js
File metadata and controls
92 lines (80 loc) · 2.84 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
document.addEventListener('DOMContentLoaded', function() {
initSmoothScroll();
initGuideTabs();
initDownloadTracking();
});
function initSmoothScroll() {
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
const headerOffset = 80;
const elementPosition = target.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.pageYOffset - headerOffset;
window.scrollTo({
top: offsetPosition,
behavior: 'smooth'
});
}
});
});
}
function initGuideTabs() {
const tabs = document.querySelectorAll('.guide-tab');
const sections = document.querySelectorAll('.guide-section');
if (tabs.length === 0) return;
tabs.forEach((tab, index) => {
tab.addEventListener('click', () => {
tabs.forEach(t => t.classList.remove('active'));
tab.classList.add('active');
sections.forEach((section, sectionIndex) => {
if (index === 0) {
section.style.display = 'block';
} else {
const visibleSections = getVisibleSections(index);
section.style.display = visibleSections.includes(sectionIndex) ? 'block' : 'none';
}
});
});
});
function getVisibleSections(tabIndex) {
switch(tabIndex) {
case 0: return [0, 1];
case 1: return [1, 2];
case 2: return [2, 3];
case 3: return [3, 4];
default: return [0, 1, 2, 3, 4];
}
}
}
function initDownloadTracking() {
document.querySelectorAll('.btn-download').forEach(btn => {
btn.addEventListener('click', function(e) {
const platform = this.closest('.download-card').querySelector('h3').textContent;
console.log(`Download clicked: ${platform}`);
});
});
}
window.addEventListener('scroll', function() {
const header = document.querySelector('.header');
if (window.scrollY > 100) {
header.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.1)';
} else {
header.style.boxShadow = 'none';
}
});
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-in');
}
});
}, observerOptions);
document.querySelectorAll('.feature-card, .feedback-card, .download-card').forEach(card => {
observer.observe(card);
});