用jquery判断当前显示器的分辨率,加载不同CSS

<link rel="stylesheet" type="text/css" id="css">
<script language="javascript">
function dis()
{
  if((screen.width == 1024) && (screen.height == 768))
  {
    document.getElementById('css').href = '2.css';
  }

  else if ((screen.width == 800) && (screen.height == 600))
  {
    document.getElementById('css').href = '1.css' ;
  }

  else
  {
    document.getElementById('css').href = '2.css';
  }
}

dis();

</script>

posted @ 2015-06-16 13:20  海角之上  阅读(737)  评论(0编辑  收藏  举报