<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Menu || MD mahedi Nishad</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<!-- all css here -->
<!-- stellarnav.css -->
<link rel="stylesheet" href="css/stellarnav.css">
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div id="main-nav" class="stellarnav">
<ul>
<li><a href="">Dropdown</a>
<ul>
<li><a href="#">How deep?</a>
<ul>
<li><a href="#">Deep</a>
<ul>
<li><a href="#">Even deeper</a>
<ul>
<li><li><a href="#">Item</a></li></li>
<li><li><a href="#">Item</a></li></li>
<li><li><a href="#">Item</a></li></li>
</ul>
</li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
</ul>
</li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
</ul>
</li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Here's a very long item. It can be as long as you want</a></li>
<li><a href="#">Item</a></li>
</ul>
</li>
<li><a href="">Item 2</a></li>
<li><a href="">Item 3</a></li>
<li><a href="">Item 4</a></li>
<li><a href="">Item 5</a></li>
<li><a href="">Item 6</a></li>
<li class="drop-left"><a href="">Drop Left</a>
<ul>
<li><a href="#">How deep?</a>
<ul>
<li><a href="#">Deep</a>
<ul>
<li><a href="#">Even deeper</a>
<ul>
<li><li><a href="#">Item</a></li></li>
<li><li><a href="#">Item</a></li></li>
<li><li><a href="#">Item</a></li></li>
</ul>
</li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
</ul>
</li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
</ul>
</li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
<li><a href="#">Item</a></li>
</ul>
</li>
</ul>
</div><!-- .stellar-nav -->
<!-- all js here -->
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery('.stellarnav').stellarNav({
theme: 'light'
});
});
</script>
</body>
</html>
/* all nav */
.stellarnav { position: relative; width: 100%; z-index: 9900; line-height: normal; }
.stellarnav ul { margin: 0; padding: 0; text-align: center; }
.stellarnav li { list-style: none; display: block; margin: 0; padding: 0; position: relative; line-height: normal; vertical-align: middle; }
.stellarnav li a { padding: 15px; display: block; text-decoration: none; color: #777; font-size: inherit; font-family: inherit; box-sizing: border-box; -webkit-transition: all .3s ease-out; -moz-transition: all .3s ease-out; transition: all .3s ease-out; }
/* main level */
.stellarnav > ul > li { display: inline-block; }
.stellarnav > ul > li > a { padding: 20px 40px; }
/* first level dd */
.stellarnav ul ul { top: auto; width: 220px; position: absolute; z-index: 9900; text-align: left; display: none; background: #ddd; }
.stellarnav li li { display: block; }
/* second level dd */
.stellarnav ul ul ul { top: 0; /* dd animtion - change to auto to remove */ left: 220px; }
.stellarnav > ul > li:hover > ul > li:hover > ul { opacity: 1; visibility: visible; top: 0; }
/* .drop-left */
.stellarnav > ul > li.drop-left > ul { right: 0; }
.stellarnav li.drop-left ul ul { left: auto; right: 220px; }
/* light theme */
.stellarnav.light { background: rgba(255, 255, 255, 1); }
.stellarnav.light ul ul { background: rgba(255, 255, 255, 1); }
.stellarnav.light li a { color: #000; }
.stellarnav.light .menu-toggle { color: rgba(0, 0, 0, 1); }
/* dark theme */
.stellarnav.dark { background: rgba(0, 0, 0, 1); }
.stellarnav.dark ul ul { background: rgba(0, 0, 0, 1); }
.stellarnav.dark li a { color: #FFF; }
.stellarnav.dark .menu-toggle { color: rgba(255, 255, 255, 1); }
/* sticky nav */
.stellarnav.fixed { position: fixed; width: 100%; top: 0; left: 0; z-index: 9999; }
/* only used when 'scrollbarFix' is set to true in the js. This fixes horizontal scrollbar caused by the dd menus that are very long.*/
body.stellarnav-noscroll-x { overflow-x: hidden; }
/* general styling */
.stellarnav li.has-sub > a:after { content: '\f0d7'; font-family: 'FontAwesome'; margin-left: 10px; }
.stellarnav li li.has-sub > a:after { content: '\f0da'; font-family: 'FontAwesome'; margin-left: 10px; }
.stellarnav li.drop-left li.has-sub > a:after { float: left; content: '\f0d9'; font-family: 'FontAwesome'; margin-right: 10px; }
.stellarnav.hide-arrows li.has-sub > a:after, .stellarnav.hide-arrows li li.has-sub > a:after, .stellarnav.hide-arrows li.drop-left li.has-sub > a:after { display: none; }
.stellarnav .menu-toggle, .stellarnav .close-menu { display: none; text-transform: uppercase; text-decoration: none; }
.stellarnav .call-btn-mobile { display: none; }
.stellarnav .dd-toggle { display: none; position: absolute; top: 0; right: 0; padding: 0; width: 48px; height: 48px; text-align: center; z-index: 9999; border: 0; }
.stellarnav .dd-toggle i { position: absolute; margin: auto; top: 33%; left: 0; right: 0; -webkit-transition: transform .3s ease-out; -moz-transition: transform .3s ease-out; transition: transform .3s ease-out; }
.stellarnav.mobile > ul > li > a.dd-toggle { padding: 0; }
.stellarnav li.call-btn-mobile, .stellarnav li.call-btn-location { display: none; }
.stellarnav li.open > a.dd-toggle i { -webkit-transform: rotate(135deg); -ms-transform: rotate(135deg); -o-transform: rotate(135deg); transform: rotate(135deg); }
/* Fallback for slow javascript */
@media only screen and (max-width : 768px) {
.stellarnav { overflow: hidden; display: block; }
.stellarnav ul { position: relative; display: none; }
}
/* mobile nav */
.stellarnav .menu-toggle { color: #777; padding: 15px; }
.stellarnav.mobile { position: static; }
.stellarnav.mobile.fixed { position: static; }
.stellarnav.mobile ul { position: relative; display: none; }
.stellarnav.mobile.active { padding-bottom: 0; }
.stellarnav.mobile.active > ul { display: block; }
.stellarnav.mobile ul { text-align: left; }
.stellarnav.mobile > ul > li { display: block; }
.stellarnav.mobile > ul > li > a { padding: 15px; }
.stellarnav.mobile ul { background: rgba(221, 221, 221, 1); }
.stellarnav.mobile ul ul { position: relative; opacity: 1; visibility: visible; width: auto; display: none; -moz-transition: none; -webkit-transition: none; -o-transition: color 0 ease-in; transition: none; }
.stellarnav.mobile ul ul ul { left: auto; top: auto; }
.stellarnav.mobile li.drop-left ul ul { right: auto; }
.stellarnav.mobile li a { border-bottom: 1px solid rgba(255, 255, 255, .15); }
.stellarnav.mobile li.has-sub a { padding-right: 50px; }
.stellarnav.mobile.light li a { border-bottom: 1px solid rgba(0, 0, 0, .15); }
.stellarnav.mobile li a.dd-toggle { border: 0; }
.stellarnav.mobile.light li a.dd-toggle { border: 0; }
.stellarnav.mobile .menu-toggle, .stellarnav.mobile .dd-toggle, .stellarnav.mobile .close-menu { display: block; }
.stellarnav.mobile li.call-btn-mobile { border-right: 1px solid rgba(255, 255, 255, .1); box-sizing: border-box; }
.stellarnav.mobile li.call-btn-mobile, .stellarnav.mobile li.call-btn-location { display: inline-block; width: 50%; text-transform: uppercase; text-align: center; }
.stellarnav.mobile li.call-btn-mobile.full, .stellarnav.mobile li.call-btn-location.full { display: block; width: 100%; text-transform: uppercase; border-right: 0; text-align: left; }
.stellarnav.mobile li.call-btn-mobile i, .stellarnav.mobile li.call-btn-location i { margin-right: 5px; }
.stellarnav.mobile.light ul { background: rgba(255, 255, 255, 1); }
.stellarnav.mobile.dark ul { background: rgba(0, 0, 0, 1); }
.stellarnav.mobile.dark ul ul { background: rgba(255, 255, 255, .08); }
.stellarnav.mobile.light li.call-btn-mobile { border-right: 1px solid rgba(0, 0, 0, .1); }
.stellarnav.mobile.top { position: absolute; width: 100%; top: 0; left: 0; z-index: 9999; }
.stellarnav.mobile li.has-sub > a:after, .stellarnav.mobile li li.has-sub > a:after, .stellarnav.mobile li.drop-left li.has-sub > a:after { display: none; }
/* mobile nav */
(function($) {
$.fn.stellarNav = function(options, width, breakpoint) {
var $nav, $width, $breakpoint;
nav = $(this);
width = $(window).width();
// default settings
var settings = $.extend( {
theme : 'plain', // adds default color to nav. (light, dark)
breakpoint: 768, // number in pixels to determine when the nav should turn mobile friendly
phoneBtn: false, // adds a click-to-call phone link to the top of menu - i.e.: "18009084500"
locationBtn: false, // adds a location link to the top of menu - i.e.: "/location/", "http://site.com/contact-us/"
sticky : false, // makes nav sticky on scroll (desktop only)
position: 'static', // 'static' or 'top' - when set to 'top', this forces the mobile nav to be placed absolutely on the very top of page
showArrows: true, // shows dropdown arrows next to the items that have sub menus
closeBtn : false, // adds a close button to the end of nav
scrollbarFix: false // fixes horizontal scrollbar issue on very long navs
}, options );
return this.each( function() {
// defines black or white themes
if (settings.theme == 'light' || settings.theme == 'dark') {
nav.addClass(settings.theme);
}
if (settings.breakpoint) {
breakpoint = settings.breakpoint;
}
// adds a location page link to the beginning of nav
if (settings.locationBtn) {
if(!settings.phoneBtn) {
var cssClass = 'full';
} else {
var cssClass = '';
}
var btn = '<li class="call-btn-location ' + cssClass + '"><a href="'+ settings.locationBtn +'"><i class="fa fa-map-marker"></i> Location</a></li>';
nav.find('ul:first').prepend(btn);
}
// adds a click-to-call link to the beginning of nav
if (settings.phoneBtn) {
if(!settings.locationBtn) {
var cssClass = 'full';
} else {
var cssClass = '';
}
var btn = '<li class="call-btn-mobile ' + cssClass + '"><a href="tel:'+ settings.phoneBtn +'"><i class="fa fa-phone"></i> Call us</a></li>';
nav.find('ul:first').prepend(btn);
}
// Makes nav sticky on scroll
if (settings.sticky) {
navPos = nav.offset().top;
if(width >= breakpoint) {
$(window).bind('scroll', function() {
if ($(window).scrollTop() > navPos) {
nav.addClass('fixed');
}
else {
nav.removeClass('fixed');
}
});
}
}
if (settings.position == 'top') {
nav.addClass('top');
}
if (!settings.showArrows) {
nav.addClass('hide-arrows');
}
if (settings.closeBtn) {
// adds a link to end of nav to close it
nav.find('ul:first').append('<li><a href="#" class="close-menu"><i class="fa fa-close"></i> Close Menu</a></li>');
}
if (settings.scrollbarFix) {
$('body').addClass('stellarnav-noscroll-x');
}
// adds the toggle button to open and close nav
nav.prepend('<a href="#" class="menu-toggle"><i class="fa fa-bars"></i> Menu</a>');
// opens and closes menu
$('.menu-toggle').on('click', function(e) {
e.preventDefault();
nav.find('ul:first').stop(true, true).slideToggle(250);
nav.toggleClass('active');
});
// actives the close button
$('.close-menu').click(function() {
nav.find('ul:first').stop(true, true).slideUp(250).toggleClass('active');
nav.removeClass('active');
});
// adds toggle button to li items that have children
nav.find('li a').each(function() {
if ($(this).next().length > 0) {
$(this).parent('li').addClass('has-sub').append('<a class="dd-toggle" href="#"><i class="fa fa-plus"></i></a>');
}
});
// expands the dropdown menu on each click
nav.find('li .dd-toggle').on('click', function(e) {
e.preventDefault();
//$(this).parent('li').toggleClass('hover');
$(this).parent('li').children('ul').stop(true, true).slideToggle(250);
$(this).parent('li').toggleClass('open');
});
var resetTriggers = function() {
nav.find('li').unbind('mouseenter');
nav.find('li').unbind('mouseleave');
}
var setTriggers = function() {
nav.find('li').on('mouseenter', function(){
$(this).addClass('hover');
$(this).children('ul').stop(true, true).slideDown(250);
});
nav.find('li').on('mouseleave', function(){
$(this).removeClass('hover');
$(this).children('ul').stop(true, true).slideUp(250);
});
}
windowCheck();
// check browser width in real-time
function windowCheck() {
var browserWidth = window.outerWidth;
if(browserWidth <= breakpoint) {
// mobile/tablet nav
resetTriggers();
nav.addClass('mobile');
nav.removeClass('desktop');
// closes the menu when resizing window back to desktop
if( !nav.hasClass('active') && nav.find('ul:first').is(':visible') ) {
//nav.addClass('active');
nav.find('ul:first').hide();
}
} else {
// desktop nav
nav.addClass('desktop');
nav.removeClass('mobile');
if(nav.hasClass('active')) {
nav.removeClass('active');
}
// ensures stellarnav is visible after resizing window
if( !nav.hasClass('active') && nav.find('ul:first').is(':hidden') ) {
nav.find('ul:first').show();
}
// hides items that were open on mobile
$('li.open').removeClass('open').find('ul:visible').hide();
resetTriggers();
setTriggers();
}
}
$(window).on('resize', function() {
windowCheck();
});
});
}
}(jQuery));