-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
67 lines (55 loc) · 2.52 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
fetch('data.json')
.then(response => response.json())
.then(data => {
// Populate the skills list
const skillsList = document.getElementById('skills-list');
data.skills.forEach(skill => {
const skillItem = document.createElement('div');
skillItem.classList.add('skill');
skillItem.textContent = skill;
skillsList.appendChild(skillItem);
});
// Populate the projects list
const projectsList = document.getElementById('projects-list');
data.projects.forEach(project => {
const projectItem = document.createElement('div');
projectItem.classList.add('project');
const projectTitle = document.createElement('h4');
projectTitle.textContent = project.title;
projectItem.appendChild(projectTitle);
const projectImage = document.createElement('img');
projectImage.src = project.image;
projectItem.appendChild(projectImage);
const projectDescription = document.createElement('p');
projectDescription.textContent = project.description;
projectItem.appendChild(projectDescription);
const projectLink = document.createElement('a');
projectLink.href = project.url;
projectLink.textContent = project.url;
projectItem.appendChild(projectLink);
if (project.loginDetails) {
const loginDetails = document.createElement('p');
loginDetails.textContent = `Username: ${project.loginDetails.username}, Password: ${project.loginDetails.password}`;
projectItem.appendChild(loginDetails);
}
const projectTechnologies = document.createElement('p');
projectTechnologies.textContent = `Technologies: ${project.technologies.join(', ')}`;
projectItem.appendChild(projectTechnologies);
projectsList.appendChild(projectItem);
});
})
.catch(error => console.error('Error fetching data:', error));
document.addEventListener('DOMContentLoaded', function () {
const sidebar = document.querySelector('.sidebar');
const toggler = document.querySelector('.navbar-toggler');
toggler.addEventListener('click', function () {
sidebar.classList.toggle('open');
if (sidebar.classList.contains('open')) {
toggler.querySelector('.navbar-toggler-icon').classList.remove('menu-icon');
toggler.querySelector('.navbar-toggler-icon').classList.add('close-icon');
} else {
toggler.querySelector('.navbar-toggler-icon').classList.remove('close-icon');
toggler.querySelector('.navbar-toggler-icon').classList.add('menu-icon');
}
});
});