【发布时间】:2012-06-24 13:07:41
【问题描述】:
我有一个 jQuery 脚本来找出浏览器的分辨率,然后更改它的 css。
if ((screen.width>=1024) && (screen.height>=768))
{
alert('Screen size: 1024x768 or larger');
$("link[rel=stylesheet]:not(:first)").attr({href : "detect1024.css"});
}
else
{
alert('Screen size: less than 1024x768, 800x600 maybe?');
$("link[rel=stylesheet]:not(:first)").attr({href : "detect800.css"});
}
});
你能帮我了解一下它的实际功能吗?
:not(:first) 是什么意思?请解释一下。
谢谢。
【问题讨论】:
-
你为什么不用media queries?如果是因为需要支持old browsers,有workarounds。
-
同
:gt(0),使用greater-than selector -
不要给我那些关于谷歌搜索的废话。我在 Google 中输入了
jquery :not(:first),verbatim,甚至在我完成之前,该死的 autocomplete 就给了我信息。jquery first not在两个选择器上都显示了文档。 -
想想“不”和“第一”这两个词的含义。考虑到这些是您在日常写作中使用的词汇,这并不难。
标签: javascript jquery html css jquery-selectors