0

I am building a website using Bootstrap 3. I followed every suggestion from this question - IE8 issue with Twitter Bootstrap 3. I have included respond.js and html5shiv.js files and everything is working fine except the navbar-collapse. Here's the navbar-collapse code:

<div class="navbar-header">
         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation </span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        <a class="navbar-brand" href="#"><img src="image.png" width="143" /></a>
 </div>
    <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav pull-right" id="nav-right">
            <li><a href="#">Home</a></li>
            <li><a href="#"><a>About</a></li>
        </ul>
    </div>

Thanks in advance!

Community
  • 1
  • 1
learner123
  • 317
  • 3
  • 8
  • 13

2 Answers2

1

My solution to a similar IE8 issue: Bootstrap IE 8 issue related to Navbar (collapsed like mobile version)

Possible Fix 1:

Basically, you need to avoid using CDN for bootstrap.min.css.

To fix the issue, you need to download bootstrap.min.css and place it in a subdirectory of your application, something like below:

/css/bootstrap/3.2.0/bootstrap.min.css

Related change in code:

If you are using bootstrap.min.css from a CDN like given below,

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

then, replace the above code with a local version of bootstrap.min.css like given below:

<link rel="stylesheet" href="./css/bootstrap/3.2.0/bootstrap.min.css">  

Possible Fix 2:

Similar IE8 issue can still occur if you are trying to run the html file stored on local machine. Running the html file from a web server will solve the issue. Detailed solution given in the above blog post.

Blesson Jose
  • 634
  • 9
  • 14
0

Mostly the problem comes from the part where we include or call the bootstrap components i.e various style-sheets java-scripts files.As per my experience when we include more bootstrap files then needed it causes conflict.I myself have done this navbar yesterday and had problem. The solutions might be:

 1.Don't include unnecessary files,brings conflict.
 2.always keep the jquery file above bootstrap.js file
 3.Use the latest version as far as it is reachable to you.

I have done the same thing yesterday.Here goes my complete Code: It is done in ASP.NET using visual studio 10.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="nav.aspx.cs" Inherits="nav" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
   <head runat="server">
<title></title>
<script src="js/jquery-1.8.3.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
</head>
<body>
 <form id="form1" runat="server">
<div>

<nav class="navbar navbar-default" role="navigation">

    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">toggle</span>
            <span class="icon-bar"></span>
             <span class="icon-bar"></span>
              <span class="icon-bar"></span>
               <span class="icon-bar"></span>
        </button>
    <a class="navbar-brand" href="#">Title</a>
    </div>
    <div class="navbar-collapse collapse">

        <ul class="nav navbar-nav">
            <li><a href="">helo</a></li>
            <li><a href="">by</a></li>
            <li><a href="">hy</a></li>
        </ul>
    </div>
    </nav>
</div>
</form>

suman
  • 718
  • 3
  • 10
  • 26