Material design (Android like) behavior on a web application

做~自己de王妃 提交于 2019-12-06 12:19:11

问题


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:

  1. Tried to use the scroll event, but unable to ascertain if the scroll was up or down because the offsetHeight and offsetTop numbers didn't change. offsetTop & offsetHeight change when the complete window scrolls, the values didn't change with our scroll which is inside the mat-tab-group.
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!