Skip to content

Commit

Permalink
Ajustes finais e animações
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitor-rs committed Sep 18, 2024
1 parent 5e35bc5 commit ad6fc93
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/SubscriptionSection.astro
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import SubscriptionCard from './SubscriptionCard.astro';
</style>

<script>
function isInViewport(element) {
function isInViewport(element: HTMLElement) {
const rect = element.getBoundingClientRect();
return (
rect.top >= 0 &&
Expand All @@ -104,8 +104,9 @@ import SubscriptionCard from './SubscriptionCard.astro';
function handleScroll() {
const animatedElements = document.querySelectorAll('.animate-fade-in, .animate-slide-in');
animatedElements.forEach(element => {
if (isInViewport(element)) {
element.style.animationPlayState = 'running';
const htmlElement = element as HTMLElement;
if (isInViewport(htmlElement)) {
htmlElement.style.animationPlayState = 'running';
}
});
}
Expand Down

0 comments on commit ad6fc93

Please sign in to comment.