屏幕分辨率为13 66 x768时,以下javascript将加载用于13 60 x768屏幕分辨率的样式:
<script type="text/javascript">
if ((screen.width = 1366)&&(screen.height = 768)) {
document.write('<link rel="stylesheet" href="css/style_1366.css" type="text/css" />');
}
if ((screen.width = 1360)&&(screen.height = 768)) {
document.write('<link rel="stylesheet" href="css/style_1360.css" type="text/css" />');
}
</script>
请您帮忙我这个剧本吗?
非常感谢,
蝙蝠
答案 0 :(得分:1)
比较使用doubled equals sign ==
答案 1 :(得分:0)
如果您使用媒体查询来确定要显示的内容,则可能会有更好的结果。这是纯粹的CSS方式。 e.g。
@media only screen and (max-width: 1360px) {
}