//防抖函数
function debounce(fun, delay) {
var timeout = null;
return function (e) {
clearTimeout(timeout);
timeout = setTimeout(() => {
fun.apply(this, arguments);
}, delay)}
}
//监视屏幕宽度变化函数
function change() {
console.log(document.documentElement.clientWidth);
}
//进行监听
window.onresize = debounce(change, 500);