Skip to content

Commit

Permalink
Fix #69
Browse files Browse the repository at this point in the history
  • Loading branch information
salah3x committed Apr 18, 2019
1 parent 6b91f09 commit d0c9994
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import { Component, OnInit, OnDestroy, Renderer2, ElementRef } from '@angular/co
})
export class HomeComponent implements OnInit, OnDestroy {

next = 2;
constructor(private renderer: Renderer2, private el: ElementRef) { }

ngOnInit() {
(this.renderer.selectRootElement('mat-sidenav-content', true) as HTMLElement)
.style.backgroundImage = 'url("/assets/empty-gym.jpg")';
.style.backgroundImage = 'url("/assets/background1.jpg';
(this.renderer.selectRootElement('mat-sidenav-content', true) as HTMLElement)
.style.backgroundPosition = 'center';
(this.renderer.selectRootElement('mat-sidenav-content', true) as HTMLElement)
Expand All @@ -20,6 +21,18 @@ export class HomeComponent implements OnInit, OnDestroy {
.style.background = '#00000090';
(this.renderer.selectRootElement('.footer', true) as HTMLElement)
.style.visibility = 'hidden';
this.changeBackground();
}

changeBackground() {
setTimeout(() => {
if (this.next === 6) {
this.next = 1;
}
(this.renderer.selectRootElement('mat-sidenav-content', true) as HTMLElement)
.style.backgroundImage = `url("/assets/background${this.next++}.jpg")`;
this.changeBackground();
}, 10000);
}

ngOnDestroy() {
Expand Down
File renamed without changes
Binary file added src/assets/background2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/background3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/background4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/background5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d0c9994

Please sign in to comment.