Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议页面向上滚动的时候,顶部菜单栏不要覆盖正文中的标题 #317

Closed
xiaoluhong opened this issue Aug 15, 2020 · 3 comments
Labels
enhancement New feature or request Plan Added in future versions

Comments

@xiaoluhong
Copy link

image
如上图,当前定位于 参考 这个标题,如果这个时候点击 Travis CI 这个标题,页面会向上滚动,顶部的菜单栏会在自动显示出来。这个时候就会覆盖了正文的标题,个人感觉不易于阅读。
image

建议页面向上滚动时候标题基于顶部菜单栏来定位。

@jerryc127
Copy link
Owner

jerryc127 commented Aug 15, 2020

你可以自己修改

你这种要额外在判定是否向上滚动 还是向下滚动
再决定是否要偏移

@jerryc127 jerryc127 added the enhancement New feature or request label Aug 15, 2020
@xiaoluhong
Copy link
Author

@jerryc127

我选择了一个折中的处理方法,控制顶部菜单显示的 top 范围,

  $(window).scroll(throttle(function (event) {
    const currentTop = $(this).scrollTop()
    const isDown = scrollDirection(currentTop)
    if (0 < currentTop && currentTop < 500) {
      if (isDown) {
        if ($nav.hasClass('visible')) $nav.removeClass('visible')
        if (isChatBtnShow && isChatShow === true) {
          chatBtnHide()
          isChatShow = false
        }

@jerryc127
Copy link
Owner

@jerryc127

我选择了一个折中的处理方法,控制顶部菜单显示的 top 范围,

  $(window).scroll(throttle(function (event) {
    const currentTop = $(this).scrollTop()
    const isDown = scrollDirection(currentTop)
    if (0 < currentTop && currentTop < 500) {
      if (isDown) {
        if ($nav.hasClass('visible')) $nav.removeClass('visible')
        if (isChatBtnShow && isChatShow === true) {
          chatBtnHide()
          isChatShow = false
        }

你自己喜欢就行啊

@jerryc127 jerryc127 reopened this Aug 17, 2020
@jerryc127 jerryc127 added the Plan Added in future versions label Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Plan Added in future versions
Projects
None yet
Development

No branches or pull requests

2 participants