How to set max-height for the scroll bar in autocomplete component

送分小仙女□ 提交于 2019-12-24 11:06:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!