html - twitter drop down not working -
here code using dropdown not being shown. javascript ref erence in correct sequence. , have added function dropdown toggle.
<!-- set viewport responsive site displays correctly on mobile devices --> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <!-- include bootstrap css --> <script src="includes/jquery/jquery-2.1.0.min.js"></script> <script src="includes/bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $('.dropdown-toggle').dropdown(); }); </script> <link href="includes/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link href="includes/style.css" rel="stylesheet"> </head> <body> <div class= "navbar navbar-inverse navbar-static-top"> <div class= "container"> <a href="#" class="navbar-brand"> tech site</a> <button= "navbar-toggle" data-toggle="collapse" data-target=".navheadercollapse"> <span class= "icon-bar"></span> <span class= "icon-bar"></span> <span class= "icon-bar"></span> </button> <div class= "collapse navbar-collapse navheadercollapse"> <ul class= "nav navbar-nav navbar-right"> <li><a href= "#" class="active"> home</a> </li> <li><a href= "#"> login</a> </li> <li class="dropdown"> <a href= "#" class="dropdown-toggle" data-toggle="dropdown"> social media<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href= "#" class="active">facebook</a> </li> <li><a href= "#">twitter</a> </li> <li><a href= "#"> google+</a> </li> </ul> </li> <li><a href= "#"> about</a> </li> <li><a href= "#"> contact</a> </li> </ul> </div> </div> </body> <div> <div class="bottom"> <div class="container"> <div class="col-md-4"> <h3><span class="glyphicon glyphicon-heart"></span> footer section 1</h3> <p>content first footer section.</p> </div> <div class="col-md-4"> <h3><span class="glyphicon glyphicon-star"></span> footer section 2</h3> <p>content second footer section.</p> </div> <div class="col-md-4"> <h3><span class="glyphicon glyphicon-music"></span> footer section 3</h3> <p>content third footer section.</p> </div> </div> </div> <!-- include jquery , bootstrap js plugins --> </body> </html> </html>
you have insert collapse plugin, , use include wright versions of jquery , bootstrap. don't have insert script of own make works. here code minimal modifications, make works:
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>bootstrap navbar collapse</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> </head> <body> <div class= "navbar navbar-inverse navbar-static-top"> <div class= "container"> <a href="#" class="navbar-brand"> tech site</a> <button class= "navbar-toggle" data-toggle="collapse" data-target=".navheadercollapse"> <span class= "icon-bar"></span> <span class= "icon-bar"></span> <span class= "icon-bar"></span> </button> <div class= "collapse navbar-collapse navheadercollapse"> <ul class= "nav navbar-nav navbar-right"> <li><a href= "#" class="active"> home</a></li> <li><a href= "#"> login</a></li> <li class="dropdown"> <a href= "#" class="dropdown-toggle" data-toggle="dropdown"> social media<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href= "#" class="active">facebook</a></li> <li><a href= "#">twitter</a></li> <li><a href= "#"> google+</a></li> </ul> </li> <li><a href= "#"> about</a></li> <li><a href= "#"> contact</a></li> </ul> </div> </div> <div> <div class="bottom"> <div class="container"> <div class="col-md-4"> <h3><span class="glyphicon glyphicon-heart"></span> footer section 1</h3> <p>content first footer section.</p> </div> <div class="col-md-4"> <h3><span class="glyphicon glyphicon-star"></span> footer section 2</h3> <p>content second footer section.</p> </div> <div class="col-md-4"> <h3><span class="glyphicon glyphicon-music"></span> footer section 3</h3> <p>content third footer section.</p> </div> </div> </div> </body> </html>
check link jsfiddle see working example. it's better if change tag of navbar navbar-inverse navbar-static-top
div
nav
. , add role="navigation"
every navbar accessibility.
hope it's useful!
Comments
Post a Comment