Turn off firefox's smooth scrolling?

前端 未结 2 1503
星月不相逢
星月不相逢 2020-12-21 22:38

Firefox\'s new smooth scrolling feature causes the scroll callback to trigger at each step in the animation.

DEMO in FF and Chrome to see the difference

Is

2条回答
  •  礼貌的吻别
    2020-12-21 23:34

    It depends on your purpose. I'm taking a guess based on your code that you would like to trigger an animation as the user scrolls down the page, a bit like Ben the Bodyguard: http://benthebodyguard.com/index.php

    To achieve this, you tie the animation to the position in the page. You can get the current scroll position from the event object that is passed to the scroll method. You'll then need to do some maths to determine if the current scroll position has changed enough to trigger the next animation.

提交回复
热议问题