简体   繁体   中英

Twitter-Bootstrap respond.js not working for IE8

I'm still having some problems getting my Twitter-Bootstrap page to display the desktop view correctly in IE8. I've been following a few threads here but the voted up advice is just not working for me.

Using the suggested meta tag

<meta http-equiv="X-UA-Compatible" content="IE=edge">

Included local versions of bootstrap.css, html5shiv.js, respond.js, ie8-responsive-file-warning.js

Here is my head section:

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="SunTrust Equity Line Options">
<meta name="author" content="">
<link rel="shortcut icon" href="favicon.ico">

<title>SunTrust &ndash; Your Equity Line is Maturing. What are your options?</title>

<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.css" rel="stylesheet">

<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="dis/js/ie8-responsive-file-warning.js"></script><![endif]-->

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="dist/js/html5shiv.js"></script>
  <script src="dist/js/respond.js"></script>
<![endif]-->

And the end of it:

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="dist/js/tooltip.js"></script>
<script src="dist/js/popover.js"></script>
<script>
$("a[rel=popover]")
    .popover()
    .click(function(e) {
        e.preventDefault();
     });
 </script> 
</body>
</html>

Try using local copy of bootstrap. This solved my problem with IE8.

Well I've asked several people and read a ton on this and still no answer on this. Seems like the only way to fix it is to call an IE8 only style sheet to get things to display correctly.

Event the getbootstrap.com examples don't work in IE8 they all stack the same way mobile first in IE8.

It's a shame really since I won't be able to use it for most projects.

Always make sure that you load the following scripts after loading jQuery.

Especially in WordPress and other frameworks some people tend to include jQuery just before the closing tag and therefore after the html5shiv.js and respond.js script, which causes issues in IE8

<!-- Include first -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.js"></script>
<![endif]--> 

i see you are using "dis/js/..." in one place and "dist/js/" in other places. Are you sure your paths are correct? I would double check the browser is actually loading the files you think its loading.

or it could be the duplication of conditional comments, try this for grins: (of course fix the paths in the below code too if "dis" or "dist" is incorrect)

<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]>
    <script src="dis/js/ie8-responsive-file-warning.js"></script>
    <script src="dist/js/html5shiv.js"></script>
    <script src="dist/js/respond.js"></script>
<![endif]-->

I'm also not familiar with ie8-responsive-file-warning.js, i would try removing that if all else fails to be sure its not conflicting with respond.js. For that matter remove html5shiv as well just to rule out all conflicts.

We discovered that having css links outside of the "head" section (essentially that for the bootstrap css) broke respond.js's ability to provide the necessary media query support as required. Ensure that all your css links live within your "head" section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM