Ask*_*mov 1 javascript mobile responsive-design
我的页面中有javascript可以检测移动浏览器,并对网站进行css调整,使其适合移动使用.
但该网站首次出现在"桌面"版本中,然后需要一些时间来重新格式化.这产生了过度的负载体验.
我很欣赏一个关于如何使用js或任何其他方式即时显示移动版本而不是桌面版本的好方法.
您可以重定向到移动页面
<script type="text/javascript">
<!--
if (screen.width <= 700) {
document.location = "/mobile";
}
//-->
</script>
Run Code Online (Sandbox Code Playgroud)
或者对于同一页面的css修复使用:
@media screen and (max-width:800px) {
// then put your mobile css in here
}
Run Code Online (Sandbox Code Playgroud)
同样的事情,但具体到iPhone 5
@media screen and (device-aspect-ratio: 40/71)
{
}
Run Code Online (Sandbox Code Playgroud)
更多信息:http: //css-tricks.com/snippets/css/media-queries-for-standard-devices/ 和 iPhone 5 CSS媒体查询
| 归档时间: |
|
| 查看次数: |
61 次 |
| 最近记录: |