function throttle(func, limit) { |
var inThrottle; |
return function () { |
var args = arguments, |
context = this ; |
if (!inThrottle) { |
func.apply(context, args); |
inThrottle = true ; |
setTimeout( function () { inThrottle = false ; }, limit); |
} |
} |
} |