Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuldeep532 authored Aug 29, 2024
1 parent 7bc0490 commit 7d13072
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Function to toggle the menu visibility
function toggleMenu() {
var navLinks = document.getElementById('nav-links');
if (navLinks.classList.contains('hidden')) {
Expand All @@ -6,3 +7,28 @@ function toggleMenu() {
navLinks.classList.add('hidden');
}
}

// Function to fetch and display features from GitHub
async function fetchFeatures() {
const featuresList = document.getElementById('features-list');
try {
const response = await fetch('https://github.com/repos/Kuldeep532/kuldeep/contents/Features');
const features = await response.json();

if (Array.isArray(features)) {
features.forEach(feature => {
const listItem = document.createElement('li');
listItem.textContent = feature.name;
featuresList.appendChild(listItem);
});
} else {
featuresList.innerHTML = '<li>No features found.</li>';
}
} catch (error) {
console.error('Error fetching features:', error);
featuresList.innerHTML = '<li>Failed to load features.</li>';
}
}

// Call the fetchFeatures function when the page loads
document.addEventListener('DOMContentLoaded', fetchFeatures);

0 comments on commit 7d13072

Please sign in to comment.