📜  js 重新加载页面 1024 断点 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:51.505000             🧑  作者: Mango

代码示例1
var ww = window.innerWidth, limit = 1025;
var refresh = function() {
  ww = window.innerWidth;
  var w = ww < limit ? (location.reload(true)) :  ( ww > limit ? (location.reload(true)) : ww=limit );
}
var tOut;
window.onresize = function() {
  var resW = window.innerWidth;
  clearTimeout(tOut);
  if ( (ww > limit && resW < limit) || (ww < limit && resW > limit) ) {
    tOut = setTimeout(refresh, 100);
  }
};