Question

im using twitter bootstrap for my responsive, I want the Nav will become a button when it views on mobile, the button for small screen shows but when i click it, it does'nt slide to show my anchors here is my codes

<header class="navbar navbar-static-top marginTop">
    <div class=" col-md-6 ">
        <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <img src="http://localhost/wordpress/wp-content/uploads/2014/03/logo.png" alt="" />
    </div>

    <div class="col-md-6">
        <nav class="collapse navbar-collapse marginTopInNavBar">
            <ul class="nav navbar-nav parentUl text-center floatLeft" >
                <li class="dropdown parentNavLi floatLeft">
                    <a href="#" class="parentNavA floatLeft" id="first">Compare Prices</a>
                    <img src="http://localhost/wordpress/wp-content/uploads/2014/03/shadowNav.png" alt="" />
                </li>

                <li class="dropdown parentNavLi floatLeft">
                    <a href="#" data-toggle="dropdown" class="dropdown-toggle parentNavA floatLeft">Buying Guides</a>
                    <img src="http://localhost/wordpress/wp-content/uploads/2014/03/shadowNav.png" alt="" />
                    <ul class="dropdown-menu childUl text-left floatLeft" id="menu1">
                        <li class="childLi"><a href="#" class="childA">Guide 1</a></li>
                        <li class="divider"></li>
                        <li class="childLi"><a href="#" class="childA">Guide 2</a></li>
                        <li class="divider"></li>
                        <li class="childLi"><a href="#" class="childA">Guide 3</a></li>
                        <li class="divider"></li>
                        <li class="childLi"><a href="#" class="childA">Guide 4</a></li>
                    </ul>
                </li>
                <li class="dropdown parentNavLi floatLeft">
                    <a href="#" class="parentNavA floatLeft">POS Type</a>
                        <img src="http://localhost/wordpress/wp-content/uploads/2014/03/shadowNav.png" alt="" />
                </li>
                <li class="dropdown parentNavLi floatLeft">
                    <a href="#" class="parentNavA floatLeft" id="last">Find Dealer</a>
                </li>
            </ul>
        </nav>
    </div>
</header>

Thank you for help!

Was it helpful?

Solution

Try this at the top:

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
</button>

Also, add this at the bottom of your page before the closing tag

<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>

OTHER TIPS

Nav Collapsing will works only when you included the jquery library in your html files.add this to your index.html and other pages before </body> tag

<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top