CSS - 手机网站回应奇怪?

问题描述:

我一直在开发一个网站,目前正在使用媒体查询来获得响应。媒体查询工作完美,网站在模拟器中变为移动。 (http://mobt.me/2T5i和Chrome的检查元素)。在这两个模拟器上,网站看起来完全是我想要的,但是当我在运行ios8的iphone 5上查看它时,它是一个完全不同的故事。我已经包含meta标签和所有内容,但它仍然在我的手机上表现得很怪异。我也检查了一个朋友的电话,同样的事情发生。您可以查看网站hereCSS - 手机网站回应奇怪?

这是它看起来像我的手机上:

出于某种原因,Safari不读您的媒体查询。我不知道为什么,但尝试这种媒体查询:

@media screen and (max-device-width:640px), screen and (max-width:640px) { 
    /* styles here */ 
} 

提示:有一些类,不要在Safari工作。

你应该做的就是将这些行添加到您的媒体查询:

@media (max-width: 775px) and (min-width: 500px) { 
.item-wrap { 
    display:none; 
} 
} 

这将隐藏您的桌面菜单(可见:隐藏,不工作)。

编辑:

那么,你应该检查你的头标签。负载的jQuery之前加载引导,尝试使用此代码:

<head> 

<title>Third Wave Analytics</title> 

<link rel="stylesheet" href="css/bootstrap.min.css"> 

<!-- Latest compiled and minified JavaScript --> 
<script src="js/jquery.js"></script> 
<script src="js/bootstrap.min.js"></script> 


<link rel="stylesheet" href="css/style.css"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> 
<meta charset="utf-8"> 
<link rel="icon" href="../../favicon.ico"> 
<link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css"> 
<link href="http://fonts.googleapis.com/css?family=Bree+Serif" rel="stylesheet" type="text/css"> 
<link href="http://fonts.googleapis.com/css?family=Roboto:400,400italic,300italic" rel="stylesheet" type="text/css"> 
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet" type="text/css"> 
<link href="http://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css"> 



<script> 
function scroll(){ 
$('.btnMedio').click(function(event) { 
    // Preventing default action of the event 
    event.preventDefault(); 
    // Getting the height of the document 
    var n = $('#myCarousel').height() + 20; 
    $('html, body').animate({ scrollTop: n }, 900); 
}); 
}; 
$(document).ready(scroll); 
</script> 
</head> 
+0

'显示:无;'没有任何改变,并使用最大设备宽度搞砸了桌面导航栏以及移动。 – Aten 2014-10-12 02:41:32

+0

它仍然不起作用,bootstrap不应该问题,因为我没有使用它。 – Aten 2014-10-12 03:46:49

+0

有时候如果有这样的错误,你可能会遇到问题。 – 2014-10-12 03:50:41