Jquery CSS不会在iPhone刷新时加载
我有一个页面,CSS最初不会加载到iPhone上,但如果我来回切换方向,它会加载 然后单击“刷新”,直到我再次更改方向,CSS才会加载 这只发生在第二页上。主页的设置方式与此基本相同,工作正常 我还有这个:Jquery CSS不会在iPhone刷新时加载,jquery,html,css,Jquery,Html,Css,我有一个页面,CSS最初不会加载到iPhone上,但如果我来回切换方向,它会加载 然后单击“刷新”,直到我再次更改方向,CSS才会加载 这只发生在第二页上。主页的设置方式与此基本相同,工作正常 我还有这个: <link rel="stylesheet" media="screen and (min-width: 20px) and (max-width: 375px) and (orientation:portrait)" href="css/detailsLayout280.css" /
<link rel="stylesheet" media="screen and (min-width: 20px) and (max-width: 375px) and (orientation:portrait)" href="css/detailsLayout280.css" />
<link rel="stylesheet" media="screen and (min-width: 20px) and (max-width: 375px) and (orientation:portrait)" href="css/copy280.css" />
<link rel="stylesheet" media="screen and (min-width: 376px) and (max-width: 700px) and (orientation:landscape)" href="css/detailsLayout320.css" />
<link rel="stylesheet" media="screen and (min-width: 376px) and (max-width: 700px) and (orientation:landscape)" href="css/copy320.css" />
这是我在iPad CSS中需要的。如果我把这个拿出来,手机的问题就消失了,虽然缩小了,但我需要iPad
为什么CSS不会加载,除非我改变方向
谢谢。您可能需要指定像素密度,因为智能手机现在的宽度为700px+ 特定于浏览器
<meta name="viewport" content="width=device-width, initial-scale=1">
这是一个如何应用此功能的快速示例
(-moz-min-device-pixel-ratio: 2)
(-o-min-device-pixel-ratio: 2/1)
(-webkit-min-device-pixel-ratio: 2)
(min-device-pixel-ratio: 2)
当您经常开发和更改css时,请更改href路径,使其包含一个问号和此后发生的变化。下面是一个使用php的示例:
<link rel="stylesheet" media="screen and (min-width: 20px) and (max-width: 375px) and (orientation:portrait) and (-webkit-min-device-pixel-ratio: 2)" href="css/detailsLayout280.css" />
这样,每次你的href都会不同。然而,它正在禁用浏览器的缓存能力,并且在生产环境中并不好。在生产过程中,确保您的css文件的名称中有版本。您如何知道他在使用php?我想我遗漏了一些东西:
<link rel="stylesheet" type="text/css" href="style.css?<?php echo date('l jS \of F Y h:i:s A'); ?>" />