无法使用 ie6 和某些移动设备处理 Modernizr.backgroundsize
我正在一个移动网络应用程序中工作,某些不支持 css3 和 @media 查询的设备存在问题,
我得到 [css3-mediaqueries.js] 以使所有浏览器支持媒体查询,但我的问题现在我需要检查不支持某些 css3 功能(例如背景大小)的设备
,我做了一些研究,发现了 Modernizer.js 可以捕获所有不支持背景大小的设备
,这是我的 HTML 标头
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>Magrabi retail</title>
<script src="js/modernizr.custom.02724.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css" /> <!-- the main css that contain all css3 class -->
<meta name="viewport" content="initial-scale=1,maximum-scale=1" />
<script src="js/css3-mediaqueries.js" type="text/javascript"></script>
<script>
Modernizr.load({
test: Modernizr.backgroundsize,
nope: 'css/main2.css' ,
});
</script>
</head>
我做了一些测试ie6 和不支持 css3 背景大小的移动设备中似乎没有什么不同,只有 Firefox 8 进行更改
只是为了注意:我使用背景大小来处理高像素密度设备
I'm working in a mobile web application, there is a problem with some devices that doesn't support css3 and @media query,
i get the [css3-mediaqueries.js] to make all browsers support the media query, but my problem now is i need to check the devices that doesn't support some css3 features like background-size
i do some researches and i found the modernizer.js that can catch all devices that doesn't support the background-size
here is my HTML header
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>Magrabi retail</title>
<script src="js/modernizr.custom.02724.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css" /> <!-- the main css that contain all css3 class -->
<meta name="viewport" content="initial-scale=1,maximum-scale=1" />
<script src="js/css3-mediaqueries.js" type="text/javascript"></script>
<script>
Modernizr.load({
test: Modernizr.backgroundsize,
nope: 'css/main2.css' ,
});
</script>
</head>
i do some tests in ie6 and in a mobile device that doesn't support css3 background-size and seems to be nothing different, only firefox 8 make the changes
just for note: i use the background-size for handle the high pixel density devices
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Modernizr 不会在本身不支持背景大小的浏览器中启用对背景大小的支持。它只是有一个方便的跨浏览器测试,可以测试 -moz-background-size 和 -ms-background-size 等内容。当测试返回 false 时,您可以伪造它。
Modernizr does not enable support for background-size in browsers that don't natively support it. It just has a convenient cross-browser test for it, that tests for things like -moz-background-size and -ms-background-size. It's up to you to fake it when the test returns false.