Simplify loading animation

This commit is contained in:
schmelczerandras 2020-11-19 13:23:05 +01:00
parent b008e91461
commit c09f576cc1
3 changed files with 5 additions and 12 deletions

View file

@ -7,8 +7,8 @@ export const generate = ({ alt }: { alt: string }): html => `
<div class="preview">
<img image-viewer-ignore class="poster" />
<div class="overlay">
<iframe title="${alt}" height=300 allowfullscreen loading="lazy"></iframe>
<div class="loading">${loading}</div>
<iframe title="${alt}" height=300 allowfullscreen loading="lazy"></iframe>
<div class="load-button">${play}</div>
</div>
</div>

View file

@ -32,13 +32,10 @@
}
}
.loading {
visibility: hidden;
&,
& > svg {
@include square(var(--large-icon-size));
@include absolute-center;
}
.loading,
.loading > svg {
@include square(var(--large-icon-size));
@include absolute-center;
}
iframe {

View file

@ -11,9 +11,6 @@ export class Preview extends PageElement {
this.url += '?portfolioView';
this.attachElementByReplacing('.poster', new Image(poster, alt));
this.query('.load-button').addEventListener('click', this.loadContent.bind(this));
this.query('iframe').addEventListener('load', () => {
this.htmlRoot.classList.remove('waiting');
});
}
public handleOnLoadEvent(event: OnLoadEvent): OnLoadEvent {
@ -27,7 +24,6 @@ export class Preview extends PageElement {
}
public loadContent() {
this.htmlRoot.classList.add('waiting');
this.htmlRoot.classList.add('loaded');
(this.query('iframe') as HTMLIFrameElement).src = this.url;
}