日期:2014-05-16  浏览次数:20400 次

使用jQuery检测用户的显示器分辨率,来加载不同的CSS
如题

求大神写详细点

------解决方案--------------------
CSS3 Media Query


<link rel="stylesheet" media="screen and (max-width: 600px)" href="css/style.css"/>


@media screen and (max-width:960px){
  html,body{}
  .header{}
  ...
}


非要js的话,获取screen的宽高,然后动态载入相应css便是

if(screen.width > 1366) {
  document.write('<link rel="stylesheet" href="css/style.css"/>');
}