Disable firefox scrolling?

The new Firefox smooth scrolling feature causes the scroll callback to run at every stage of the animation.

DEMO in FF and Chrome to see the difference

Is there any way to make it so that it

  • Only one event is executed when the page has finished scrolling.
  • Make the page scroll sharply, like in Chrome
+1
javascript jquery
source share
2 answers

Try the following:

function throttle( fn, timeout ) { var tid = 0; return function() { clearTimeout( tid ); var args = [].slice.call( arguments ), ctx = this; tid = setTimeout( function() { fn.apply( ctx, args ); }, timeout ); }; } $(window).on("scroll", throttle( function() { $('div').eq(0).append('scroll happened'); }, 100)); 

It will only trigger scrolling as soon as scrolling does not occur in 100 milliseconds.

http://jsfiddle.net/NLGHS/1/

+4
source share

It depends on your purpose. I accept the assumption based on your code that you would like to start the animation when the user scrolls down the page, a little like Ben the Bodyguard: http://benthebodyguard.com/index.php

To achieve this, you snap the animation to a position on the page. You can get the current scroll position from an event object that is passed to the scroll method. Then you will need to do some mathematical calculations to determine if the current scroll position has changed to trigger the next animation.

0
source share

All Articles