forked from GarimaSingh0109/Resum-Resume
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
182 lines (148 loc) · 4 KB
/
script.js
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
const toggleSwitch = document.getElementById('dark-mode-toggle');
// Check for saved user preference in local storage
const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
if (currentTheme) {
document.body.classList.toggle('dark-mode', currentTheme === 'dark');
toggleSwitch.checked = currentTheme === 'dark';
}
toggleSwitch.addEventListener('change', () => {
document.body.classList.toggle('dark-mode');
// Save preference to local storage
if (document.body.classList.contains('dark-mode')) {
localStorage.setItem('theme', 'dark');
} else {
localStorage.setItem('theme', 'light');
}
});
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
const PORT = 3000;
let comments = [];
app.use(cors());
app.use(bodyParser.json());
app.get('/comments', (req, res) => {
res.json(comments);
});
app.post('/comments', (req, res) => {
const newComment = req.body.comment;
comments.push(newComment);
res.status(201).json(newComment);
});
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});
document.addEventListener('DOMContentLoaded', () => {
const commentForm = document.getElementById('comment-form');
const commentInput = document.getElementById('comment-input');
const commentsDiv = document.getElementById('comments');
// Load comments from the server
fetch('http://localhost:3000/comments')
.then(response => response.json())
.then(comments => {
comments.forEach(comment => {
const div = document.createElement('div');
div.textContent = comment;
commentsDiv.appendChild(div);
});
});
// Handle form submission
commentForm.addEventListener('submit', (e) => {
e.preventDefault();
const comment = commentInput.value;
fetch('http://localhost:3000/comments', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ comment })
})
.then(response => response.json())
.then(newComment => {
const div = document.createElement('div');
div.textContent = newComment;
commentsDiv.appendChild(div);
commentInput.value = ''; // Clear the input
});
});
});
// animations.js
// Navbar Animation
gsap.from(".navbar", {
duration: 1,
y: -50,
opacity: 0,
ease: "power2.out",
delay: 0.5
});
// Header Logo Animation
gsap.from(".logo", {
duration: 1,
opacity: 0,
x: -50,
ease: "power2.out",
delay: 0.7
});
// Header Icons Animation
gsap.from(".icons a", {
duration: 1,
opacity: 0,
scale: 0,
stagger: 0.2,
ease: "back.out(1.7)",
delay: 0.9
});
// Home Section Content Animation
gsap.from(".home .content h3", {
duration: 1,
opacity: 0,
y: 30,
ease: "power2.out",
delay: 1.2
});
gsap.from(".home .content p", {
duration: 1,
opacity: 0,
y: 20,
ease: "power2.out",
delay: 1.4
});
// Get Started Button Animation
gsap.from(".home .content .btn", {
duration: 1,
opacity: 0,
scale: 0,
ease: "back.out(1.7)",
delay: 1.6
});
// Features Cards Animation
gsap.from(".features-card", {
scrollTrigger: {
trigger: ".features",
start: "top 75%",
toggleActions: "play none none reverse"
},
duration: 1,
opacity: 0,
y: 20,
stagger: 0.2,
ease: "power2.out"
});
// Testimonials Animation
gsap.from(".testimonial-card", {
scrollTrigger: {
trigger: ".testimonials",
start: "top 75%",
toggleActions: "play none none reverse"
},
duration: 1,
opacity: 0,
y: 20,
stagger: 0.2,
ease: "power2.out"
});
// var typed = new Typed('#newlogo', {
// strings: ['EnhanCV.'],
// typeSpeed: 50,
// });