Skip to content

Commit

Permalink
add smooth transition for marquee images after theyre loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
LXIF committed Nov 21, 2024
1 parent c7cb1fd commit 050279a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/frontend/src/flows/dappsExplorer/teaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ const marqueeList = (dapps: KnownDapp[]): TemplateResult => {
// later.
({ logoSrc, name }) => html`<div class="c-marquee__item">
<div class="c-marquee__image-container">
<img src=${logoSrc} alt="${name}" class="c-marquee__image" />
<img
src=${logoSrc}
alt="${name}"
class="c-marquee__image c-marquee__image--loading"
@load=${(e: Event) => {
const img = e.target as HTMLImageElement;
img.classList.remove('c-marquee__image--loading');
img.classList.add('c-marquee__image--loaded');
}}
/>
</div>
</div>`
);
Expand Down
9 changes: 9 additions & 0 deletions src/frontend/src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3251,6 +3251,15 @@ input[type="checkbox"] {
height: 100%;
width: 100%;
object-fit: contain;
transition: opacity 0.3s ease-in;
}

.c-marquee__image--loading {
opacity: 0;
}

.c-marquee__image--loaded {
opacity: 1;
}

@keyframes marquee {
Expand Down

0 comments on commit 050279a

Please sign in to comment.