i am using bootstrap navbar for menu, i have added dropdown submenu i.e menu under submenu, i want to open submenu on hover as it was on click, i used some method but none of it work properly,my code as follow
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<!-- Collapsed Hamburger -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Branding Image -->
<div class="logo-container">
<a class="navbar-brand" href="">
--}}
<img src="Images/group_65.jpg" class="img-responsive logo-images imgcenter">
</a>
</div>
</div>
<div class="collapse navbar-collapse" id="app-navbar-collapse" style="margin-left: 150px">
<!-- Left Side Of Navbar -->
<ul class="nav navbar-nav main-menu">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">My Classes<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Change Class</a></li>
<li><a href="#">Groups</a></li>
</ul>
</li>
<li><a href="">Roster</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Admin<span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a class="" href="#">Manage Users</a>
<ul class="dropdown-menu">
<li><a href="#">All Users</a></li>
<li><a href="#">Admin</a></li>
</ul>
</li>
<li><a href="#">Programs</a></li>
<li><a href="#">Documents</a></li>
<li class="dropdown-submenu">
<a class="" href="#">Gallery</a>
<ul class="dropdown-menu">
<li><a href="#">Calendar</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Holidays</a></li>
</ul>
</li>
<li><a href="#">Staff Attendance</a></li>
<li><a href="#">Payroll</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Food</a></li>
</ul>
<li><a href="">SoCo Help</a></li>
</li>
</ul>
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
@if (Auth::guest())
<li><a href="">Login</a></li>
<li><a href="">Register</a></li>
@else
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="caret"></span> --}}
<img class="avtar" src="uploads/profile/" style="height: 19px;">
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href=""
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
<i class="glyphicon glyphicon-log-out"></i> Logout
</a>
<form id="logout-form" action="" method="POST" style="display: none;">
</form>
</li>
</ul>
</li>
@endif
</ul>
</div>
</div>
I have added script for dropdown submenu as
$('.dropdown-submenu a').on("click", function(e){
$(this).next('ul').toggle();
e.stopPropagation();
e.preventDefault();
});
so whet is the proper way to accomplish this ? please help and it should work for collapse too.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2v0OLit
via IFTTT
Aucun commentaire:
Enregistrer un commentaire