问题
Scenario
We got a mat-toolbar and a mat-tab-group - the behavior we need is like the GIF below i.e. when we scroll down, the mat-tab-group (Cats in the gif below) is scrollable and the mat-toolbar (Pets in the gif below) hides away, only to show up again after we scroll back up.
The code
Approaches i tried:
- Tried to use the scroll event, but unable to ascertain if the scroll was up or down because the
offsetHeightandoffsetTopnumbers didn't change.offsetTop&offsetHeightchange when the complete window scrolls, the values didn't change with our scroll which is inside themat-tab-group. - Tried an observable to the mouse scroll, which works on the overall page, but stops capturing the scroll within our
mat-list
Question:
- How to capture the scroll inside the
mat-tab-group? - If this is not the correct way to achieve it, looking for guidance on the correct approach
- the GIF was taken from Material Design standard
来源:https://stackoverflow.com/questions/55015895/material-design-android-like-behavior-on-a-web-application