簡體   English   中英

有沒有辦法在 angular cdk-virtual-scroll 中禁用滾動?

[英]Is there a way to disable scroll in angular cdk-virtual-scroll?

我想防止滾動條在 cdk-virtual-scroll 中默認移動? 有辦法嗎? 我一直在研究很多,但沒有找到一種方法來做到這一點。

完全防止滾動:

<cdk-virtual-scroll-viewport [style.overflow]="hidden">
// or toggling:
<cdk-virtual-scroll-viewport [style.overflow]="(enableScroll$ | async) ? 'auto' : 'hidden'">

隱藏滾動條但允許滾動:

<cdk-virtual-scroll-viewport [ngClass]="{hidden_scrollbar: hideScrollbar$ | async}">

.hidden_scrollbar {
    overflow-y: scroll;
    scrollbar-width: none; /* Firefox */
   -ms-overflow-style: none; /* Internet Explorer 10+ */
 }
.hidden_scrollbar::-webkit-scrollbar {
  /* WebKit */
  width: 0;
  height: 0;
}
   

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM