问题
I am using autocomplete component in my project, along with the autocomplete component i have added an button inside the component for adding a new customer as shown in below image.
Here i want to achieve 2 things:
1) I want to make button as fixed even after the scroll(i,e Add New Customer).
2) I want to reduce the height of the scroll bar. How can i do this? Here is the forked stackblitz link
回答1:
1) Use position:sticky:
.add-button{
position: sticky;
top: 0;
z-index: 2;
}
2) Use height to .cdk-overlay-pane with ::ng-deep
::ng-deep .cdk-overlay-pane{
height: 150px!important;}
See here:https://stackblitz.com/edit/angular-9ao75y-fc23aj?file=app/autocomplete-filter-example.css
来源:https://stackoverflow.com/questions/52160180/how-to-set-max-height-for-the-scroll-bar-in-autocomplete-component