WP8 IE10视口问题

时间:2013-01-26 10:49:19

标签: css windows-phone-8 viewport internet-explorer-10

您是否注意到在使用-ms-viewport(特定宽度为320px或设备宽度)时,是否可以将Web浏览器内容移动到可用空间之外?看起来文档大小是错误的,所以我可以将它的内容滚动到左侧,但没有任何东西,然后是空白空间。我也可以缩小它(但我不应该)它之后的尺寸并不总是相同的。我知道http://mattstow.com/responsive-design-in-ie10-on-windows-phone-8.html但它没有帮助。它在第二次或第三次导航到同一内容后发生,并在例如旋转设备时消失。

2 个答案:

答案 0 :(得分:3)

Windows Phone 8无法正确识别webkit和移动网络标准的meta viewport标记。

在CSS中试试这个

@-ms-viewport{width:device-width}

然后添加这个JS

if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
    var msViewportStyle = document.createElement("style");
    msViewportStyle.appendChild(
        document.createTextNode(
            "@-ms-viewport{width:auto!important}"
        )
    );
    document.getElementsByTagName("head")[0].
        appendChild(msViewportStyle);
}

More here (credit)

答案 1 :(得分:0)

尝试添加以下内容

@-ms-viewport {
    user-zoom: fixed;
    max-zoom: 1;
    min-zoom: 1;
}
相关问题