I'm working on a Responsive Mega Menu and I can't seem to get it to open the mobile toggler/display nav links.
I've looked into a few different fixes but as a beginner (still in school) they're outside of my scope of understanding.
A) One Solution suggested a conflicting issue where they needed to !important a display.
B) The other solution I found suggested that the ID/Selectors weren't targeting properly. (I think this might be my issue... but I'm not sure what ID/Selectors would be causing the problem as I've tried playing around with them and not really got anywhere.)
<!--
Bootstrap docs: https://getbootstrap.com/docs
-->
<div class="section">
<div class="container">
<div class="row">
<div class="col-12">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<img src="/images/logonobg2.png" alt="Musical Logo" width="200" aria-hidden="true">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#dropdown01" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item dropdown megamenu-li">
<a class="nav-link" href="" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">About</a>
<div class="dropdown-menu megamenu" aria-labelledby="dropdown01">
<div class="row">
<div class="col-sm-6 col-lg-3">
<h5>Musical Soloists</h5>
<a class="dropdown-item" href="#">About Us</a>
<a class="dropdown-item" href="#">Charity Info</a>
<a class="dropdown-item" href="#">Artistic Director</a>
<a class="dropdown-item" href="#">Board of Directors</a>
</div>
<div class="col-sm-6 col-lg-3">
<h5>More Links</h5>
<a class="dropdown-item" href="#">Staff & Volunteers</a>
<a class="dropdown-item" href="#">Something else here</a>
<a class="dropdown-item" href="#">Another action</a>
</div>
<div class="col-sm-6 col-lg-3">
<h5>Musical Soloists</h5>
<a class="dropdown-item" href="#">About Us</a>
<a class="dropdown-item" href="#">Charity Info</a>
<a class="dropdown-item" href="#">Artistic Director</a>
<a class="dropdown-item" href="#">Board of Directors</a>
</div>
<div class="col-sm-6 col-lg-3">
<h5>Musical Soloists</h5>
<a class="dropdown-item" href="#">About Us</a>
<a class="dropdown-item" href="#">Charity Info</a>
<a class="dropdown-item" href="#">Artistic Director</a>
<a class="dropdown-item" href="#">Board of Directors</a>
</div>
</div>
</div>
</li>
<li class="nav-item dropdown megamenu-li">
<a class="nav-link" href="" id="dropdown02" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Education & Community</a>
<div class="dropdown-menu megamenu" aria-labelledby="dropdown02">
<div class="row">
<div class="col-sm-6 col-lg-3">
<h5>Musical in School</h5>
<a class="dropdown-item" href="#">About Us</a>
<a class="dropdown-item" href="#">Charity Info</a>
<a class="dropdown-item" href="#">MiS Gallery</a>
<a class="dropdown-item" href="#">Booking / Fees</a>
</div>
<div class="col-sm-6 col-lg-3">
<h5>Summer Music Institute</h5>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
<div class="col-sm-6 col-lg-3">
<h5>Certain Events Awards</h5>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</div>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
.section {
padding: 3px 50px;
background-color: black;
}
.nav-link {
color: aliceblue;
}
.megamenu-li {
position: static;
}
.megamenu {
position: absolute;
width: 100%;
left: 0;
right: 0;
padding: 15px;
border-radius: 0%;
opacity: 95%;
}
.navbar {
padding-left: 15%;
margin: 1rem 2rem;
background-color: #26272b !important;
}
/* Styles TopNav Logo away from Nav-links in normal view and in the responsive menu. */
.topnavlogo {
margin-bottom: 2px;
}
.container-fluid {
align-content: space-around;
}
/* affects all top nav besides Home (.Disabled) */
.navbar a:hover {
color: #f17917;
}
/* This section wraps the top nav */
.section {
background-color: #26272b;
}
.dropdown-menu {
border-radius: 0%;
}
/* TOP NAV SEARCH FORM STYLES BEGIN */
/* TOP NAV SEARCH FORM STYLES BEGIN
-------------------------------------- */
.form-control:focus {
border-color: #f17917;
box-shadow: none; /* removes blue hue/shadow from topnav search text input */
}
.btn {
border-color: #f17917;
color: #f17917;
margin-right: 20%;
}
.btn:hover {
background-color: #f17917;
border-color: #f17917;
}
/* TOP NAV SEARCH FORM STYLES END */
/* Top Nav Styles End */
/* Main Styles Begin */
main {
margin: 7rem 4rem;
text-align: justify;
}
/* Main Styles End */
http://jsfiddle.net/uhrzo30p
Related
The vertical pills layout is exactly what I want for desktop devices, but for small screen sizes, I want it to be more compact. I need the tab-pane text to display under the nav-link - like under each individual nav-link, not below the whole group of nav-pills.
The following is the base example on the Bootstrap v5 documentation:
<div class="d-flex align-items-start">
<div class="nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<button class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</button>
<button class="nav-link" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</button>
<button class="nav-link" id="v-pills-messages-tab" data-bs-toggle="pill" data-bs-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</button>
<button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>
</div>
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">...</div>
<div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">...</div>
<div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">...</div>
<div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">...</div>
</div>
</div>
I tried moving the tab-pane elements directly under their perspective nav-links, but I couldn't get it to work.
Is this possible to do what I'm envisioning? Or alternatively, is there a better way to set this up?
Here is an example using Bootstrap 5's responsive grid classes and CSS media queries to achieve the desired behavior:
<div class="d-flex flex-column flex-md-row align-items-start">
<div class="nav flex-column nav-pills w-100 w-md-auto me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<button class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</button>
<button class="nav-link" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</button>
<button class="nav-link" id="v-pills-messages-tab" data-bs-toggle="pill" data-bs-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</button>
<button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>
</div>
<div class="tab-content w-100" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">...</div>
<div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">...</div>
<div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">...</div>
<div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">...</div>
</div>
</div>
<style>
#media (max-width: 767.98px) {
.nav-pills {
display: flex;
flex-wrap: wrap;
}
.tab-content {
display: flex;
flex-wrap: wrap;
}
.tab-pane {
width: 100%;
}
}
</style>`
This will display the nav-pills vertically on larger screens, and horizontally on smaller screens, with the tab-pane elements displayed directly underneath the corresponding nav-link.
I'm using bootstrap's navbar and it shows perfectly on a large screen, but when it gets to mobile, it disappears completely.
I've tried #media and changing the sizes but it's not really working.
**css**
#navbar {display: inline-block; background-color: #ffffff; color: #FFFFFF;}
#navbar a:link {outline: 0;}
#navbar a:visited {color: #101010; margin:2px; padding: 5px;}
#navbar a:active,
#navbar a:hover {background-color: #f5f5f5; color: #C21315;text-decoration: none; outline: 0;}
/* NAVIGATION BAR LINKS */
#navbar li a { display: inline-block; overflow:visible; }
#navbar li { display: inline-block; overflow:visible; }
#media screen and (max-width: 600px) {
#navbar {display: block;}
}
**Bootstrap navbar**
<nav id="navbar" class="navbar">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle-"collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only"> Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a style=" font-size: 1.1em; padding-left: 25px; padding-right: 35px;" href="#"> <span class="glyphicon glyphicon-home" aria-hidden="true"></span><span class="sr-only">Home</span></a></li>
<li class="dropdown">
<a style=" font-size: 1.3em; padding-left: 25px; padding-right: 35px;" href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
About </a>
<ul class="dropdown-menu" >
<li>Our Library</li>
<li>Action2</li>
<li>Action3</li>
<li>Action</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
Does the space collapse or does it just look hidden?
I can't replicate your problem. Works fine on my machine. Can you paste the whole HTML file here? (including the javascript and css imports). If you are not using the cdn (you have your .js and .css files downloaded and linked from some folder, just write the version of these imported files)
It has been solved (somewhat)
I needed to add .navbar-toggle and .navbar-toggle .icon-barin the css
I am using UI Bootstrap 14.3 and I am trying to have an image within the NavBar to dropdown a menu when clicked.
I have implemented the below code however the menu pops up at the top of the page and is not aligned under the image.
Does anybody have any suggestions to fix and improve this below solution?
<span uib-dropdown on-toggle="toggled(open)">
<a href id="simple-dropdown" uib-dropdown-toggle style="padding-top: 0px; padding-bottom: 0px;">
<img src="http://placehold.it/30x30" class="img-rounded" alt="Rounded Image" style="position: relative;top: 10px;float: left; left: -5px;height:100%;">
</a>
<ul class="uib-dropdown-menu" aria-labelledby="simple-dropdown" style="">
<li>
</span> Settings
</li>
</ul>
</span>
By removing the span and moving uib-dropdown to the li element. It aligned perfectly
<li uib-dropdown style="padding-left:0px;margin-left:0px;">
<a href id="simple-dropdown" uib-dropdown-toggle class="profile-image dropdown-toggle" style="padding-top: 10px; padding-bottom: 10px;">
<img src="http://placehold.it/30x30" class="img-rounded" alt="Rounded Image" style="heigth:30px;width:30px;margin-left:0px;padding-left:0px;">
</a>
<ul class="uib-dropdown-menu" aria-labelledby="simple-dropdown" style="">
<li>
</span> Settings
</li>
<li>
</span> Sponsored
</li>
<li>
</span> Admin Console
</li>
<li>
</span> Logout
</li>
</ul>
</li>
How to differentiate SPA appearance for Admin and normal user in Angular JS? I did try ng-show to but while refreshing the page the hidden options in menu is visible for a second. Any best practice to separate page fields and options for admin and normal user?
<div class="container navbarcontainer">
<nav class="navbar navbar-inverse" style="z-index: 1;">
<div class="container-fluid" style="padding-right: 12px; padding-left: 12px; font-size: 12px;">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse scrollable-menu" id="myNavbar">
<ul class="nav navbar-nav showActiveClasss boxyfontmenu">
<li><a ui-sref="home" class="visible-xs bordermenuitem" data-toggle="collapse" data-target=".navbar-collapse"><span class="" id="sp">Home</span></a>
<a ui-sref="home" class="hidden-xs bordermenuitem" id="sp">Home</span></a>
</li>
<li><a ui-sref="ringtones" class="visible-xs" data-toggle="collapse" data-target=".navbar-collapse"><span id="sp">Ringtones</span></a>
<a ui-sref="ringtones" class="hidden-xs"><span id="sp">Ringtones</span></a>
</li>
<li ng-show="user.role=='admin'"><a ui-sref="userList" class="visible-xs" data-toggle="collapse" data-target=".navbar-collapse"><span id="sp">User list</span></a>
<a ui-sref="userList" class="hidden-xs"><span id="sp">User list</span></a>
</li>
<li><a ui-sref="contactus" class="visible-xs" data-toggle="collapse" data-target=".navbar-collapse"><span id="sp">Contact us</span></a>
<a ui-sref="contactus" class="hidden-xs"><span id="sp">Contact us</span></a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><i class="fa fa-facebook-square facebook"></i></li>
<li><i class="fa fa-twitter twitter"></i></li>
<li><i class="fa fa-youtube-play youtube"></i></li>
</ul>
</div>
</div>
</nav>
</div>
hide all by default and set style for rules maybe
<li class="hidden-by-default" ng-class="{'hidden-by-default': !isAdmin}"></li>
Set isAdmin in controller with timout to false or when you load the rules from server... it will work by default :D
Note that your initial value should be true for this
I am trying to make the entire panel-heading click-able. I tried wrapping the div with some css.
plunkr
#box {
padding: 10px;
display: block;
width: 100%;
}
HTML:
<a id="box">
<div class="panel-heading" toggle target="collapse{{$index}}">
<h4 class="panel-title">
<span style="font-size:12px">Name :</span> <span ng-click="selectJob(currentItem, $index)">{{currentItem.JobName}}</span>
</h4>
</div>
</a>
Move ngClick to a element:
<a id="box" ng-click="selectEmployee(employee, $index)">
<div class="panel-heading" toggle target="collapse{{$index}}">
<h4 class="panel-title">
<span>{{employee.firstName}} {{employee.lastName}}</span>
</h4>
</div>
</a>
Demo: http://plnkr.co/edit/nOGHHQWxT5lEKbulmGtJ?p=preview