Hello readers, Today in this blog you'll learn how to create a Side Menu Bar with sub-menu using HTML CSS & JavaScript. Earlier I have shared a Side Navigation Menu Bar without sub-menu, but my viewers requested me many times to create Side Bar Menu with submenu, now it's time to create Side Menu Bar with submenu or dropdown menu.
A drop-down menu is a horizontal list of menu options that each contain a vertical menu. When you hover or click one of the primary options in a drop-down menu, a list of choices will "drop down" below the main menu. The most common type of drop-down menu is a menu bar or Navigation Menu bar.
Today in this blog, I'll share with you this program (Side Menu Bar with sub-menu). At first, there is only a button and this sidebar menu is hidden. But when you clicked on that button then this sidebar will be shown from sliding from the left side. In the menus, there is a cool hover effect too.That means when you hovered on the specific item, a small line will appear on the left side of that list, and also the color of that item becomes cyan as you can see in the image.
If you're feeling difficult to understand what I am saying. You can watch a full video tutorial on this program (Side Menu Bar with sub-menu).
Video Tutorial of Side Menu Bar with Submenu
I hope you've understood the basic codes of this sidebar and I believe this video helped the beginners to understand the codes and concepts behind creating the sidebar menu. You can use this Sidebar on your websites, projects, and anywhere you want.
If you like this program (Side Menu Bar with sub-menu) and want to get source codes. You can easily get the source codes of this program. To get the source codes you just need to scroll down.
If you like this program (Side Menu Bar with sub-menu) and want to get source codes. You can easily get the source codes of this program. To get the source codes you just need to scroll down.
You might like this:
Sidebar Menu with Drop-down Menu [Source Codes]
As always, before sharing the codes of this program (sidebar menu with the dropdown menu). Let's a few talk about the main tags and codes of this program. At first, in the HTML File, I created a <nav> with the class name "sidebar " and placed all tags inside it. This is a <ul> <li> based program so we can create menu list easily. Then I created <ul> tag I placed all <li> tags inside it. Inside <li> tag I created <a> anchor tag. To create those submenu I created <ul> tags inside <li> tags. As you can call it nested tags.
In the CSS File, first I did basic styling to navbar like gave colors, height-width, padding, etc. After styling the navbar I placed all menu items and sub-menu items vertically. Then I hide all submenu items and also hide the sidebar with sliding -260px to the left slide. On the screen there I have shown only the menu button for show sidebar when this button clicked.
In the jQuery File, I created a click function and show that hidden Sidebar menu on button click. jQuery click event occurs when you click on an HTML element. jQuery click() method is used to trigger the click event. For example $(“p”). click() will trigger the click event when a paragraph is clicked on a document (a web page).
To create this program (Side Menu Bar with sub-menu). First, you need to create two Files one HTML File and another one is CSS File. After creating these files just paste these following codes in your file. You can also download the source code files through the given link. Click here to download source code files.
In the CSS File, first I did basic styling to navbar like gave colors, height-width, padding, etc. After styling the navbar I placed all menu items and sub-menu items vertically. Then I hide all submenu items and also hide the sidebar with sliding -260px to the left slide. On the screen there I have shown only the menu button for show sidebar when this button clicked.
In the jQuery File, I created a click function and show that hidden Sidebar menu on button click. jQuery click event occurs when you click on an HTML element. jQuery click() method is used to trigger the click event. For example $(“p”). click() will trigger the click event when a paragraph is clicked on a document (a web page).
To create this program (Side Menu Bar with sub-menu). First, you need to create two Files one HTML File and another one is CSS File. After creating these files just paste these following codes in your file. You can also download the source code files through the given link. Click here to download source code files.
CSS FILE:
Help.. Keep sharing
ReplyDeleteThank you...Keep visiting!
DeleteGreat stuff!
ReplyDeleteThank you...Keep visiting!
Deletehow do i disable to the cross button and toggle of the side menu. I want the side menu to show on the page all the time
ReplyDeletePlease contact me on Instagram. I'll do it for you.
DeleteNice Web gan
ReplyDeletei want to add this code to my view of a template and don't know how.. can you plz help me?
ReplyDeleteCopy the given codes and paste where you want but remember that you've to do some changes in codes according to your site layout.
DeleteHi, how can I set a url at every button of the submenu, when I click on tha button can show of my link embedded in the content?
ReplyDeletethanks for you help
Just insert the url of your content inside the href attribute of a tag.
ReplyDeleteIs the side menu bar responsive?
ReplyDeleteNO but I have already posted a blog on this. Please visit or search title in the search bar.
Deletenice
ReplyDeleteThank you :)
DeleteWaaaouh thank you for your tutorial and the source files really I become strong day by day because of you, It is possible to have tutorials for creating a complete website as you would like or we can put things on your site, I am without pres in CSS e JS I want to attack PHP;)
ReplyDeleteHi guy! already thank you for your work it's great! I am working with your menu for a school project and I found a small bug when you select a submenu and then another menu, this one remains active. So I added this line which seems to correct everything.
ReplyDelete$('nav ul li').click(function(){
$('nav ul li').removeClass("active");
$(this).addClass("active").siblings().removeClass("active");
});
Yes it also works
DeleteThank u sir for providing tutorial.
ReplyDeleteYou're welcome :)
DeleteGood job! I like it, easy and clear! Based on it I made my menu for WP
ReplyDeleteThank you so much
DeleteThanks for the code. Dont know why but the Font Awesome is not working right.
ReplyDeletePlease read the pinned comment of this video
DeletePost a Comment
We welcome relevant and respectful comments. Off-topic or spam comments may be removed.