ngx-ui-scroll: Wrong scroll position on start when an items height > viewport and inverse = true
There seem to be an issue with wrong scroll position for ‘startIndex’ setting when an item heigh > viewport height.
A demo https://stackblitz.com/edit/angular-ngx-ui-scroll-1-3-0-tbjtc1?file=src%2Fapp%2Fapp.component.css
If we use
.item {
height: 50px;
}
then all is ok
but if we set something bigger than a viewport, e.g.
.item {
height: 350px;
}
then there is an issue with proper scroll positioning.
There can be a case in chat apps, where a message can contain lots of text and the mobile device screen is not so big, so the issue can occur
Please let me know if anything else is needed too trace it
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (7 by maintainers)
@DaveLomber You know, the
inversesetting is pretty dumb. Per inverse demo description:In your case it just does not have an impact on the result due to the fact that the item is big enough and there is no need to stretch paddings. In other words, if the visible part of the viewport is filled, the
inversesetting will not affect the view.Instead I would use a combination of
reversesetting (when cumulative height of initial items is less than the height of the viewport) and autoscroll feature (when the item you want to be shown first is bigger that the viewport). For the second part I suggest following approach:The demo is here – https://stackblitz.com/edit/angular-ngx-ui-scroll-1-4-1-scroll-to-bottom-of-item. Try to switch
COUNTto 1…@dhilt could you please check this demo https://stackblitz.com/edit/angular-ngx-ui-scroll-1-3-0-rnsvxm?file=src/app/app.component.ts
with your math provided it’s better, but I still randomly can face the issue in my app, and now I reproduced it in a demo
One element should be bigger than the rest - and then the issue occurs