节流函数

节流函数

$(document).ready(function(){
  var timer =null//必须有,省略节流失效
  $(window).resize(function(){
    clearTimeout(timer)
    timer = setTimeout(function(){$("span").text(x+=1)},1300);
  });
});

posted @ 2017-12-20 20:14  黄先森  阅读(195)  评论(0编辑  收藏  举报