weixin_39639643
2021-01-12 14:45 阅读 0

Feature Discussion: Scroll to bottom is element is near bottom

When an element is too close to the bottom of the page for scrolling to place it at the top, there is a sudden stop when the page hits the bottom. There could be an option to scroll to the bottom if the element to be scrolled to is in this region.

Something in the config object like { clipToBottom: true }.

I'd be willing to create a PR if this sounds like a reasonable feature.

该提问来源于开源项目:cferdinandi/smooth-scroll

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

8条回答 默认 最新

  • weixin_39883286 weixin_39883286 2021-01-12 14:45

    Hey - first off, THANK YOU for such a well formed issue/feature request. This is super helpful!

    Now the nitty gritty: how might this behavior differ from the default?

    点赞 评论 复制链接分享
  • weixin_39639643 weixin_39639643 2021-01-12 14:45

    It would simply provide a nicer experience to cover the edge case where an element cannot be scrolled to entirely.

    点赞 评论 复制链接分享
  • weixin_39883286 weixin_39883286 2021-01-12 14:45

    Forgive me for being dense, but what exactly would the behavior look like? How would the scrolling animation differ from what it does today?

    点赞 评论 复制链接分享
  • weixin_39639643 weixin_39639643 2021-01-12 14:45

    Red: what it's trying to to Blue: what happens Purple: what i'm suggesting be an option

    capture

    Where 0.6 is the maximum scroll amount.

    点赞 评论 复制链接分享
  • weixin_39883286 weixin_39883286 2021-01-12 14:45

    Ah ok, so you want to, if the scrolling will be cut short because you'll reach the end of the page, calculate the distance based on stopping at the bottom to provide a smoother animation?

    If so, yes, I'm 100% in favor of this.

    点赞 评论 复制链接分享
  • weixin_39883286 weixin_39883286 2021-01-12 14:45

    I would also make doing this the default behavior.

    点赞 评论 复制链接分享
  • weixin_39639643 weixin_39639643 2021-01-12 14:45

    Yes, that's what I'd like to see.

    点赞 评论 复制链接分享
  • weixin_39883286 weixin_39883286 2021-01-12 14:45

    Fixed: https://github.com/cferdinandi/smooth-scroll/releases/tag/v14.2.0

    点赞 评论 复制链接分享

相关推荐