Restore image fade in functionality

This commit is contained in:
2018-04-29 16:36:02 +01:00
parent 000acc5d67
commit b73a4ec61b
3 changed files with 62 additions and 1 deletions

18
js/image.js Normal file
View File

@@ -0,0 +1,18 @@
export default class Image {
constructor(image) {
this.image = image;
}
showImage() {
this.image.style.opacity = 1;
}
fadeIn() {
this.image.style.opacity = 0;
this.attachLoadedEvent();
}
attachLoadedEvent() {
this.image.addEventListener('load', () => this.showImage());
}
}