<script>
window.onresize = function (){
if(window.screen.width>960){
document.body.style.backgroundColor = "red";
}else if(window.screen.width>640){
document.body.style.backgroundColor = "blue";
}else{
document.body.style.backgroundColor = "green";
}
}
</script>
检测屏幕的宽度,更换背景色
最新推荐文章于 2023-01-07 03:00:10 发布