-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
166 lines (146 loc) · 5.74 KB
/
Copy pathscript.js
File metadata and controls
166 lines (146 loc) · 5.74 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
// Simple animation for testimonial slider
document.addEventListener('DOMContentLoaded', function() {
const slider = document.querySelector('.testimonial-slider');
let scrollAmount = 0;
const scrollStep = 320; // card width + gap
function autoScroll() {
if (scrollAmount >= slider.scrollWidth - slider.clientWidth) {
scrollAmount = 0;
} else {
scrollAmount += scrollStep;
}
slider.scrollTo({
left: scrollAmount,
behavior: 'smooth'
});
}
// Auto scroll every 5 seconds
setInterval(autoScroll, 5000);
// Add hover effect to feature cards
const featureCards = document.querySelectorAll('.feature-card');
featureCards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-10px) scale(1.02)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0) scale(1)';
});
});
// Add click effect to CTA buttons
const ctaButtons = document.querySelectorAll('.cta-button');
ctaButtons.forEach(button => {
button.addEventListener('click', function() {
this.style.transform = 'scale(0.95)';
setTimeout(() => {
this.style.transform = '';
}, 200);
// Show appropriate message based on button type
if (this.classList.contains('demo-btn')) {
showModal('Demo Video', 'A demo video would play here showing MoneySaathi features in action.');
} else {
showModal('Get Started', 'Welcome to MoneySaathi! Signup functionality would appear here.');
}
});
});
// Smooth scrolling for navigation links
const navLinks = document.querySelectorAll('nav a[href^="#"]');
navLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetSection = document.querySelector(targetId);
if (targetSection) {
const offsetTop = targetSection.offsetTop - 80;
window.scrollTo({
top: offsetTop,
behavior: 'smooth'
});
}
});
});
// Add scroll animation to elements
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// Observe feature cards and steps for animation
const animatedElements = document.querySelectorAll('.feature-card, .step');
animatedElements.forEach(el => {
el.style.opacity = '0';
el.style.transform = 'translateY(20px)';
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
observer.observe(el);
});
// Modal function for displaying messages
function showModal(title, message) {
// Remove existing modal if any
const existingModal = document.querySelector('.modal-overlay');
if (existingModal) {
existingModal.remove();
}
// Create modal
const modalOverlay = document.createElement('div');
modalOverlay.className = 'modal-overlay';
modalOverlay.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 2000;
`;
const modalContent = document.createElement('div');
modalContent.className = 'modal-content';
modalContent.style.cssText = `
background: white;
padding: 2rem;
border-radius: 15px;
max-width: 500px;
width: 90%;
text-align: center;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
`;
modalContent.innerHTML = `
<h3 style="color: var(--blue); margin-bottom: 1rem;">${title}</h3>
<p style="margin-bottom: 2rem; color: #555;">${message}</p>
<button class="cta-button close-modal">Close</button>
`;
modalOverlay.appendChild(modalContent);
document.body.appendChild(modalOverlay);
// Close modal functionality
const closeButton = modalContent.querySelector('.close-modal');
closeButton.addEventListener('click', function() {
modalOverlay.remove();
});
modalOverlay.addEventListener('click', function(e) {
if (e.target === modalOverlay) {
modalOverlay.remove();
}
});
}
// Add some interactive elements to steps
const steps = document.querySelectorAll('.step');
steps.forEach((step, index) => {
step.addEventListener('click', function() {
const stepMessages = [
"Securely connect your bank accounts in just a few clicks",
"Our AI analyzes your spending patterns and categorizes transactions",
"Set realistic financial goals based on your income and spending",
"Get personalized investment advice to grow your wealth"
];
showModal(`Step ${index + 1}`, stepMessages[index]);
});
});
});