与Windows 8和Windows Phone 8中的Bootstrap Internet Explorer 10混淆 [英] Confused with Bootstrap Internet Explorer 10 in Windows 8 and Windows Phone 8

查看:47
本文介绍了与Windows 8和Windows Phone 8中的Bootstrap Internet Explorer 10混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人可以帮助我理解这一点.在引导程序上参考此页面. http://getbootstrap.com/getting-started/#support-ie10-width

Hope someone can help me understand this. Referring to this page on bootstrap. http://getbootstrap.com/getting-started/#support-ie10-width

我需要在CSS中添加它吗?

Do I need to add this in my CSS?

@-webkit-viewport   { width: device-width; }
@-moz-viewport      { width: device-width; }
@-ms-viewport       { width: device-width; }
@-o-viewport        { width: device-width; }
@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.querySelector('head').appendChild(msViewportStyle)
}

任何例子都将不胜感激.

Any example would be much appreciated.

推荐答案

以下信息在您发布的链接中:

The following information is in the link you posted:

请注意,我们将此内容包含在Bootstrap的所有文档中,例子作为演示.

As a heads up, we include this in all of Bootstrap's documentation and examples as a demonstration.

这是一个演示,因此它不包含在Bootstrap中,您必须自己添加它.

It is a demonstration and so it is not included in Bootstrap itself, you have to add it yourself.

编辑

例如,您可以将代码添加到< body> 的末尾或< head> 中,如下所示:

As an example, you can just add the code at the end of the <body> or in the <head> like so:

<script>
    if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
        var msViewportStyle = document.createElement('style')
        msViewportStyle.appendChild(
                document.createTextNode(
                        '@-ms-viewport{width:auto!important}'
                )
        )
        document.querySelector('head').appendChild(msViewportStyle)
    }
</script>

,并确保已将CSS添加到CSS文件中或作为< head>

and make sure you've added the CSS to your CSS file or as style in the <head>

这篇关于与Windows 8和Windows Phone 8中的Bootstrap Internet Explorer 10混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆