I would like to prevent scrollbar from moving by default in cdk-virtual-scroll? Is there way to do it? I have been researching a lot but did not find a way to do it.
Prevent scrolling completely:
<cdk-virtual-scroll-viewport [style.overflow]="hidden">
// or toggling:
<cdk-virtual-scroll-viewport [style.overflow]="(enableScroll$ | async) ? 'auto' : 'hidden'">
Hide scrollbar but allow scrolling:
<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;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.