Side Menu Bar with sub-menu using HTML CSS & Javascript
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.
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.HTML FILE: