Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Mummanajagadeesh authored Nov 10, 2024
1 parent 2986752 commit 119f501
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,44 @@ <h2>Contact</h2>
});
});

// // Intersection Observer for scrolling effect
// const sections = document.querySelectorAll('.section');
// const observer = new IntersectionObserver((entries) => {
// entries.forEach(entry => {
// if (entry.isIntersecting) {
// entry.target.classList.add('active');
// }
// });
// });
// sections.forEach(section => {
// observer.observe(section);
// });


// Intersection Observer for scrolling effect
const sections = document.querySelectorAll('.section');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const sections = document.querySelectorAll('.section');

const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
// Check if the section is intersecting with the viewport
if (entry.isIntersecting) {
// Add 'active' class when entering the viewport
entry.target.classList.add('active');
} else {
// Remove 'active' class when exiting the viewport
entry.target.classList.remove('active');
}
});
});
sections.forEach(section => {
observer.observe(section);
});
},
{
threshold: 0.3, // Trigger when 10% of the section is visible
}
);

// Observe each section
sections.forEach((section) => observer.observe(section));


// Toggle menu for mobile
const menuIcon = document.querySelector('.menu-icon');
Expand Down

0 comments on commit 119f501

Please sign in to comment.