-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
42 lines (37 loc) · 1.56 KB
/
script.js
File metadata and controls
42 lines (37 loc) · 1.56 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
fetch('data.json')
.then(response => response.json())
.then(data => {
document.getElementById('name').textContent = data.name;
document.getElementById('tagline').textContent = data.tagline;
document.getElementById('bio').textContent = data.bio;
// Skills
const skillsContainer = document.getElementById('skills');
data.skills.forEach(skill => {
const span = document.createElement('span');
span.textContent = skill;
skillsContainer.appendChild(span);
});
// Projects
const projectList = document.getElementById('project-list');
data.projects.forEach(project => {
const div = document.createElement('div');
div.classList.add('project-card');
div.innerHTML = `
<img src="${project.image}" alt="${project.title}">
<h4>${project.title}</h4>
<p>${project.description}</p>
<a href="${project.link}" target="_blank">View Project</a>
`;
projectList.appendChild(div);
});
// Contact
document.getElementById('email').textContent = data.email;
document.getElementById('email').href = `mailto:${data.email}`;
document.getElementById('linkedin').href = data.linkedin;
// Footer year
document.getElementById('year').textContent = new Date().getFullYear();
});
// Theme toggle
document.getElementById('theme-toggle').addEventListener('click', () => {
document.body.classList.toggle('dark');
});