Skip to content

Commit 4d97756

Browse files
authored
Update fast-search-card.js
1 parent 9d54c72 commit 4d97756

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

dist/fast-search-card.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8147,11 +8147,33 @@ class FastSearchCard extends HTMLElement {
81478147
videoElement.src = newVideoUrl;
81488148
videoElement.load();
81498149

8150+
// Fade-in nach erfolgreichem Laden
8151+
videoElement.addEventListener('canplay', () => {
8152+
videoElement.animate([
8153+
{ opacity: 0, transform: 'scale(0.95)' },
8154+
{ opacity: 1, transform: 'scale(1)' }
8155+
], {
8156+
duration: 600,
8157+
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
8158+
fill: 'forwards'
8159+
});
8160+
}, { once: true });
8161+
81508162
videoElement.onended = function() {
81518163
this.pause();
81528164
this.currentTime = this.duration - 0.1;
81538165
};
81548166
};
8167+
} else if (videoElement.style.opacity === '0' || !videoElement.style.opacity) {
8168+
// Erstes Laden - direkte Fade-in Animation
8169+
videoElement.animate([
8170+
{ opacity: 0, transform: 'scale(0.95)' },
8171+
{ opacity: 1, transform: 'scale(1)' }
8172+
], {
8173+
duration: 600,
8174+
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
8175+
fill: 'forwards'
8176+
});
81558177
}
81568178
}
81578179

@@ -14794,8 +14816,7 @@ class FastSearchCard extends HTMLElement {
1479414816
const videoId = `video-${item.id.replace(/\./g, '-')}`;
1479514817

1479614818
return `
14797-
<video class="icon-video" id="${videoId}" autoplay muted playsinline
14798-
oncanplay="this.parentElement.parentElement.parentElement.fastSearchCard.animateVideoIn(this)">
14819+
<video class="icon-video" id="${videoId}" autoplay muted playsinline>
1479914820
<source src="${videoUrl}" type="video/mp4">
1480014821
<source src="${videoUrl.replace('.mp4', '.webm')}" type="video/webm">
1480114822
</video>

0 commit comments

Comments
 (0)