关闭firefox的平滑滚动? [英] Turn off firefox's smooth scrolling?
本文介绍了关闭firefox的平滑滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Firefox的新平滑滚动功能会导致滚动回调在动画的每一步触发。
Firefox's new smooth scrolling feature causes the scroll callback to trigger at each step in the animation.
有没有办法让它变得如此
Is there any way to have it so that it
- 仅在页面滚动完成时触发一个事件
- 使页面突然像在Chrome中一样滚动
推荐答案
试试这个:
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));
一旦在100毫秒内没有滚动,它将仅触发滚动。
It will only fire the scroll once no scroll has happened in 100 milliseconds.
这篇关于关闭firefox的平滑滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文