js 监听浏览器窗口大小,从而达到媒体查询效果
2021-11-03 本文已影响0人
高坚果_
window.onresize = function(res){
console.log(res.currentTarget.innerWidth);
// 如果浏览器屏幕判断到小于990px ,则跳转手机屏幕
if(res.currentTarget.innerWidth > 990){
window.location = "index1.html";
}
}