In my Angular app (version 2+), the current code I have is:
.header {
background: rgba(white, 0);
&.fixed-top {
background: rgba(white, 1);
border-bottom: solid whitesmoke 1px;
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
}
}
<nav class="navbar navbar-toggleable-sm header" [class.fixed-top]="stickyHeader" (scroll)="scrollHandler()">...</nav>
The handleScroll()
function changes the value of stickyHeader
to true
when the user scrolls past a certain point, making the header menu stick to the top. Here's the code snippet:
stickyHeader = false;
@HostListener('window:scroll', [])
scrollHandler() {
this.stickyHeader = window.scrollY > 90;
}
My query is: how can I add an animated sliding effect to make the menu appear as if it is descending from the top of the browser?