// JS防抖
function debounce(fn,wait){
var timer = null;
return function(){
if(timer !== null){
clearTimeout(timer);
}
timer = setTimeout(fn,wait);
}
}
function handle(){
console.log('修改');
}
window.addEventListener("resize",debounce(handle,1000));
JS节流代码
最新推荐文章于 2024-08-08 16:01:56 发布