Respond.js with twitter bootstrap on ie8 and below

无人久伴 提交于 2019-12-01 19:11:25

https://github.com/scottjehl/Respond#cdnx-domain-setup

CDN/X-Domain Setup

Respond.js works by requesting a pristine copy of your CSS via AJAX, so if you host your stylesheets on a CDN (or a subdomain), you'll need to upload a proxy page to enable cross-domain communication.

See cross-domain/example.html for a demo:

Upload cross-domain/respond-proxy.html to your external domain
Upload cross-domain/respond.proxy.gif to your origin domain
Reference the file(s) via <link /> element(s):

<!-- Respond.js proxy on external server -->
<link href="http://externalcdn.com/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />

<!-- Respond.js redirect location on local server -->
<link href="/path/to/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />

<!-- Respond.js proxy script on local server -->
<script src="/path/to/respond.proxy.js"></script>

If you are having problems with the cross-domain setup, make sure respond-proxy.html does not have a query string appended to it.

Note: HUGE thanks to @doctyper for the contributions in the cross-domain proxy!

You need to include <script src="./js/respond.min.js"></script> above the </head> tag.

If you don't want to add any code related with respond.js, load bootstrap.min.css through CDN except for IE 8. For IE 8, use local static file.

    <!--[if lte IE 8]>                                                      
        <link rel="stylesheet" href="/path/to/bootstrap.min.css' %}" />
    <![endif]-->                                                            
    <!--[if gt IE 8]>                                         
        <link rel="stylesheet" href="{CDN Address}" />                                                      
    <![endif]-->                                              
    <!--[if !IE]><!-->                                        
        <link rel="stylesheet" href="{CDN Address}" />
    <!--<![endif]-->

Tested on IE 8 ~ 11 and other webkit browsers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!