Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsilva010 authored Apr 14, 2024
1 parent e2e9a5f commit 76bc599
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions docs/script.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
const keyFeaturesList = document.getElementById('key-features');
const listItems = document.querySelectorAll('#key-features li');

window.onload = function() {
keyFeaturesList.style.opacity = 0; // Initially hide the list
listItems.forEach(item => {
item.addEventListener('mouseenter', () => {
item.style.backgroundColor = '#f0f0f0';
item.querySelector('.feature-description').style.display = 'block';
});

// Animation function to gradually show the list
const animateList = () => {
let opacity = 0;
const intervalId = setInterval(() => {
opacity += 0.1;
keyFeaturesList.style.opacity = opacity;
if (opacity >= 1) {
clearInterval(intervalId);
}
}, 20); // Adjust the interval for animation speed (lower for faster)
};

animateList();
};
item.addEventListener('mouseleave', () => {
item.style.backgroundColor = '';
item.querySelector('.feature-description').style.display = 'none';
});
});

0 comments on commit 76bc599

Please sign in to comment.