【发布时间】:2014-12-12 18:34:12
【问题描述】:
我使用以下视口显示平板电脑上的所有内容,我的网站只有 980 像素宽度。 当我使用这个时,网站上的所有内容都是可见的,我喜欢这个。
<meta name="viewport" content="width=1600" />
但对于纵向,它需要 width=1000。 我们有什么办法可以玩方向:风景吗? 我正在寻找一个js解决方案。
我尝试使用 css 解决方案,但我的全屏背景滑块无法正常工作(不是全屏)。因此,如果有人知道如何在平板电脑上更改元内容宽度,请告诉我。
尝试了一些没有运气的解决方案,我想我已经接近了:
<meta id="viewport" name="viewport" content="width=1000">
<script>
$(document).ready(function() {
if (screen.width > 1000) {
document.getElementById("viewport").setAttribute("content", "width=1600");
}
});
</script>
【问题讨论】:
-
检查生成的源时,它会正确更改。为什么它在我的 ipad 上不起作用?在准备好文件和不准备文件的情况下进行了尝试。我需要其他方法吗?
-
好的,所以我需要在其中添加纵向或横向: if (screen.width.. 那需要是 if screensize.portrait 或其他东西