摘要: 用于封装js兼容性的函数 阅读全文
posted @ 2021-04-09 21:32 火烧云Z 阅读(44) 评论(0) 推荐(0)
摘要: 事件被触发、n秒内只执行一次事件处理函数 function throttle(fn,time){ var t = null, begin = new Date().getTime(), res; var throttled = function(){ var _this = this, nowDat 阅读全文
posted @ 2021-04-09 21:30 火烧云Z 阅读(49) 评论(0) 推荐(0)
摘要: n秒内只要你触发事件,就重新计数。 持续触发 事件处理函数的程序将永远不能被执行 function debounce(fn,time,trggleNow){ var t = null, res; var debounced = function(){ var _this = this, //保存th 阅读全文
posted @ 2021-04-09 21:29 火烧云Z 阅读(63) 评论(0) 推荐(0)