Reputation: 85
Injected into my component is a navigation bar. Code is similar to below.
<app-shopping-nav ></app-shopping-nav>
<div class="body>
Content goes here
</div>
I want the
<app-shopping-nav ></app-shopping-nav>
injection to stick on top on scroll down.
here's what I have tried:
I tried adding class to it
I also tried wrapping it around a span with the a class
Here is the css class
.stickNav{
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 2;
overflow: hidden;
z-index: 2;
}
Upvotes: 0
Views: 877
Reputation: 2164
I think I have a solution for you. It seems like a tricky problem. Here is a solution given below =>
<app-shopping-nav class="stickNav"></app-shopping-nav>
<div class="body>
Content goes here
</div>
It should work. I have made a demo for you in stackblitz. Please check and let me know. Working Demo in StackBlitz.
Upvotes: 1