我正在做一些HTML5模板,我在互联网上看了一些其他人是如何做的例子,因为我想把我的工作放在主题森林上,我在一个例子中发现了这种和平的代码,我真的不知道它是如何工作的。所以,如果有人能帮助我理解这一点,那就太好了
var pd = {},
verboseBuild = !0,
screenXs = 480,
ltIE9 = !1;
/* Modernizer */
!$("html").is(".lt-ie9") || (ltIE9 = !0),
Modernizr.addTest("ipad", function () {
return !!navigator.userAgent.match(/iPad/i);
}),
Modernizr.addTest("iphone", function () {
return !!navigator.userAgent.match(/iPhone/i);
}),
Modernizr.addTest("ipod", function () {
return !!navigator.userAgent.match(/iPod/i);
}),
Modernizr.addTest("appleios", function () {
return Modernizr.ipad || Modernizr.ipod || Modernizr.iphone;
}),
Modernizr.appleios && $("html").addClass("ios-device"),
!verboseBuild || console.log("Starting builds:"),
$(document).ready(function () {
!verboseBuild || console.log("-- starting proton.common build"),
pd.common.build();
}),有人能解释一下verbosebuild = !0和itE9 = !1是什么意思吗?
谢谢!
发布于 2014-01-12 08:44:55
好的:
!0只是true!1的别名简单地说就是false!!<something>的别名,将false)转换为<something> (将始终返回true或boolean
(顺便说一句,我不知道他们的开发人员为什么要做前两个,在我看来,那是微优化,那不应该做)。
所以,举个例子:
ltIE9 = !1表示IE版本为9或更高
希望这能有所帮助。干杯
https://stackoverflow.com/questions/21069847
复制相似问题