!(function () { return; function debounce(func, wait, immediate) { var timeout, result; return function () { var context = this; var args = arguments; if (timeout) cleartimeout(timeout); if (immediate) { // 如果已经执行过,不再执行 var callnow = !timeout; timeout = settimeout(function () { timeout = null; }, wait); if (callnow) result = func.apply(context, args); } else { timeout = settimeout(function () { func.apply(context, args); }, wait); } return result; }; } window.onresize = debounce( function () { var clientwidth = document.documentelement.clientwidth; var roothtml = document.documentelement; var design_width = 1920; var rem_size = (16 / design_width) * clientwidth; console.log('rem size :>> ', rem_size); roothtml.style.fontsize = `${rem_size}px`; }, 1000, false ); })();