-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
58 lines (49 loc) · 1.91 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Landing Page - List of Names with Images</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to Our Landing Page</h1>
<button id="dark-mode-toggle">Dark Mode</button>
</header>
<section class="name-list" id="name-list">
<!-- Name items will be dynamically added here -->
</section>
<footer>
<p>© Hacktoberfest 2024. All rights reserved.</p>
</footer>
<script src="listContribute.js"></script>
<script>
const nameListSection = document.getElementById('name-list');
const darkModeToggle = document.getElementById('dark-mode-toggle');
// Load the contributors from the listContribute.js file
contributors.forEach(contributor => {
const nameItem = document.createElement('div');
nameItem.classList.add('name-item');
const img = document.createElement('img');
img.src = contributor.image;
img.alt = contributor.name + " Image";
const nameHeading = document.createElement('h2');
nameHeading.textContent = contributor.name;
nameItem.appendChild(img);
nameItem.appendChild(nameHeading);
nameListSection.appendChild(nameItem);
});
// Toggle Dark Mode
darkModeToggle.addEventListener('click', () => {
document.body.classList.toggle('dark-mode');
const isDarkMode = document.body.classList.contains('dark-mode');
localStorage.setItem('dark-mode', isDarkMode);
});
// Load user's theme preference from localStorage
if (localStorage.getItem('dark-mode') === 'true') {
document.body.classList.add('dark-mode');
}
</script>
</body>
</html>