Refactor background-position logic in header component
This commit is contained in:
parent
7b377a3667
commit
ab3abe7f6b
|
|
@ -1,6 +1,6 @@
|
||||||
<ng-container>
|
<ng-container>
|
||||||
<header id="top"
|
<header id="top"
|
||||||
[ngStyle]="{ 'background-image': getBackgroundImage(), 'height': height, 'background-position': 'center ' + inverseYPos + 'px' }">
|
[ngStyle]="{ 'background-image': getBackgroundImage(),'height': height, 'background-position': getBackgroundPosition() }">
|
||||||
<nav id="nav" [ngClass]="active">
|
<nav id="nav" [ngClass]="active">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="mobile_nav">
|
<div id="mobile_nav">
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,12 @@ export class HeaderComponent {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getBackgroundPosition() {
|
||||||
|
if (this.current_page === 'home') {
|
||||||
|
return 'center ' + this.inverseYPos + 'px'
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user