Bootstrap toggle navbar not showing content -
i newbie bootstrap, having problem toggle navbar menu. data or list item not appear when screen size reduced mobile size there appears toggle button not anything.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <title>bootstrap 101 template</title> <!-- bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respond.js doesn't work if view page via file:// --> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"> </script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="navbar navbar-default" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data- toggle="collapse" data-target="navbar-container"> <span class="sr-only">show & hide navigation</span> </button> </div> <div class="collapse navbar-collapse" id="navbar-container"> <ul class="nav navbar-nav"> <li><a href="#">home</a></li> <li><a href="#">profile</a></li> <li><a href="#">contact us</a></li> </ul> </div> </div> </div> <!-- jquery (necessary bootstrap's javascript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"> </script> <!-- include compiled plugins (below), or include individual files needed --> <script src="js/bootstrap.min.js"></script> </body> </html>
actually there 2 mistakes in code.
replace line
<button type="button" class="navbar-toggle" data- toggle="collapse" data-target="navbar-container"> with one
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-container"> reason
there space in between data-toggle , had not put # sign navbar-container in data-target attribute.
Comments
Post a Comment