Javascript – Bootstrap 3.3.5 – navbar-toggle button not working on iphone

csshtmljavascriptjquerytwitter-bootstrap

I am working on a bootstrap site and are having issues with my navbar-toggle when viewed on my iphone and ipad. The dropdown button is visible, but does not respond or expand. Seems to be working well in all my computer's browsers.

I am using bootstrap v3.3.5 and jquery-1.11.3

<head>

    <!-- Website Title & Description for Search Engine purposes -->
    <title></title>
    <meta name="description" content="">

    <!-- Mobile viewport optimized -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <!-- Bootstrap CSS -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="bootstrap/fonts/bootstrap-glyphicons.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="includes/css/styles.css" rel="stylesheet">
    <link href="includes/css/fonts.css" rel="stylesheet">
    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600|Arvo' rel='stylesheet' type='text/css'>

    <!-- Include Modernizr in the head, before any other Javascript -->
    <script src="includes/js/modernizr-2.6.2.min.js"></script>

</head> 

Here is my navbar

<!--Navbar-->
<div class="navbar" role="navigation">
    <div class="container">

        <!--navbar responsive toggle-->
        <div class="navbar-header">
            <button class="navbar-toggle collapsed" type="button" data-target="#navbar-responsive-collapse" data-toggle="collapse" >
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <!-- brand and toggle grouped together for better mobile display -->
            <img class="navbar-brand" src="images/navbar_logo.png" alt="logo">
        </div><!--end of navbar-header-->

        <div class="collapse navbar-collapse" id="navbar-responsive-collapse">
            <ul class="nav navbar-nav navbar-default" id="myNav">
                <li class="active">
                    <a href="index.html"> Home</a>
                </li>
                <li>
                    <a href="services.html"> Services</a>
                </li>
                <li>
                    <a href="contact.html"> Contact</a>
                </li>
            </ul>
        </div><!-- end of collapse-->
    </div><!-- end of container-->
</div><!-- end of navbar -->

bottom links.

<!-- All Javascript at the bottom of the page for faster page loading -->

<!-- First try for the online version of jQuery-->
<script src="http://code.jquery.com/jquery.js"></script>

<!-- If no online access, fallback to our hardcoded version of jQuery -->
<script>window.jQuery || document.write('<script src="includes/js/jquery-1.11.3.min.js"><\/script>')</script>

<!-- Bootstrap JS -->
<script src="bootstrap/js/bootstrap.min.js"></script>

here is a js.fiddle if you would like to see the css: https://jsfiddle.net/Dinkledine/asLLydyz/8/

I've seen similar posts to this, and these are the workarounds I've gathered. So far none of them have worked. So i'm starting to think its my markup.

ive tried:
updating bootstrap from v3.3.4 to v3.3.5…..
updating jquery from 1.8.2 to 1.11.3…..
replacing "ontouchstart" to "disable-ontouchstart" within bootstrap.min.css

thanks for your help!

Best Answer

Bootstrap v2 Dropdown Navigation not working on Mobile Browsers

Safari on iPhone only support click event for <a> and <input> element.

You can find your fix here.