函数节流

// (来自)JavaScript高级程序设计 不支持匿名函数
function throttle(fn, context) {
    clearTimeout(fn.tId);
    fn.tId = setTimeout(function () {
        fn.call(context);
    }, 100);
}
// (来自)百度 不支持匿名函数
function throttle(fn) {
    var args, that, timer = null;
    return function () {
        clearTimeout(timer);
        args = arguments;
        that = this;
        timer = setTimeout(function () {
            fn.call(that, args);
        }, 100);
    };
}
原文地址:https://www.cnblogs.com/shanchenba/p/5644862.html