I am using cdk-virtual-scroll.
It is working fine without using the css property scroll-snap-type
.
When I use scroll-snap-type
it is flickering few seconds. herewith I attached the code sample
https://stackblitz.com/edit/angular-gchlgl?file=src%2Fstyles.scss,src%2Fapp%2Fcdk-virtual-scroll-data-source-example.css,src%2Fapp%2Fcdk-virtual-scroll-data-source-example.html
Any help? Thanks.
If you are using
cdk-virtual-scroll
, you should define the exact pixel size of your container and item. BecauseitemSize
attribute is defining the size of the item. So in your code, the size of the items are same but in responsive size (not fixed using pixel), but you define theitemSize
is 740px. I thought that will be crash thecdk-virtual-scroll
to improve performance of your website while doing the calculation of rendering a lot of items.I've update your code and add attributes
itemSize
,minBufferPx
,maxBufferPx
:SEE DEMO: StackBlitz
HTML
And update some responsive CSS properties to fixed size:
CSS