我有一个简单的页面,可以通过窗口手机放大,但我想锁定缩放。任何帮助我如何防止网页缩放窗口手机8
这是代码
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>HI there</title>
<script type="text/javascript" src="jquery.js" ></script>
</head>
<body>
<div style="width:100%; height:100px; background:red;">
hi this is just the sample
</div>
</body>
</html>
答案 0 :(得分:1)
<head>
<title>HI there</title>
<script type="text/javascript" src="jquery.js" ></script>
<!-- add the viewport tag -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<style>
/* not needed @-ms-viewport{
width: device-width;
} */
</style>
</head>
将initial-scale=1, maximum-scale=1,
添加到head
答案 1 :(得分:1)
您是否尝试将maximum-scale=1
添加到该元标记中?有关详细信息,请参阅https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag。