请参阅http://jsfiddle.net/5MvnA/2/和控制台。
Fs 应该比 Ks 少,但根本没有 Fs。
我得到了去抖代码
function debounce(fn, delay) {
var timer = null;
return function () {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
};
}
从这里http://remysharp.com/2010/07/21/throttling-function-calls/
介意检查我是否做错了吗?