Skip to content

Commit

Permalink
Floating agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritwik Srivastava authored and Ritwik Srivastava committed Jun 4, 2024
1 parent 8e64dff commit 8fcc666
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions blocks/floatingagent/floatingagent.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ export default function decorate(block) {
agentInfo,
contactButton,
);
const displayedElement = document.querySelector('.floatingagent');

const heroElement = document.querySelector('.hero-wrapper');

const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
displayedElement.style.display = 'none';
} else {
displayedElement.style.display = 'flex';
}
});
}, {
threshold: [0],
});

observer.observe(heroElement);
}

const displayedElement = document.querySelector('.floatingagent');
Expand Down

0 comments on commit 8fcc666

Please sign in to comment.