jQuery Accordion Vertical Menu using CSS

Today, We want to share with you jQuery Accordion Vertical Menu using CSS.In this post we will show you Vertical accordion menu using jQuery and CSS3, hear for How To Code a Vertical Accordion Nav Menu with jQuery we will give you demo and example for implement.In this post, we will learn about How to create Accordion Vertical Menu using JQuery and CSS? with an example.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Snippet Contents

jQuery Accordion Vertical Menu using CSS

There are the Following The simple About A Simple Accordion Menu using jQuery and CSS Full Information With Example and source code.

As I will cover this Post with live Working example to develop accordion jquery examples with source code, so the jquery accordion menu vertical 3 level is used for this example is following below.

HTML Part

index.html

I will create HTML file.Just see bellow HTML with jQuery and css example html file and run in your local too.

<div class="primarycatslist">
<ul class="accordion">
 	<li><a href="#">Home</a></li>
 	<li class="haschild"><a href="#">Electronics Tools</a>
<ul style="display: none;">
 	<li class="lisubfirst"><a href="#"> Electronics Tools 1</a></li>
 	<li><a href="#">Electronics Tools 2</a></li>
 	<li class="haschild"><a> Electronics Tools 3</a>
<ul style="display: none;">
 	<li class="lisubfirst"><a> Sub Electronics Tools 1</a></li>
 	<li><a href="#"> Sub Electronics Tools 2</a></li>
 	<li><a href="#"> Sub Electronics Tools 3</a></li>
 	<li class="lisublast"><a href="#"> Sub Electronics Tools 4</a></li>
</ul>
</li>
 	<li class="lisublast"><a href="#"> Electronics Tools 4</a></li>
</ul>
</li>
 	<li id="l3" class="haschild"><a href="#">Management</a>
<ul style="display: none;">
 	<li><a href="#"> Management 1</a></li>
 	<li><a href="#"> Management 2</a></li>
 	<li class="lisublast"><a href="#"> Management 3</a></li>
</ul>
</li>
 	<li><a href="#">About Us</a></li>
</ul>
</div>

Step 2: jQuery/JavaScript Part

we will simply include jquery CDN file. as well as We added some custom jQuery or pure JavaScript Source code.

using jquery CDN

<script type="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

jQuery Source code

$(document).ready(function() {

$('.accordion li').click(function(ev) {

if (!$(ev.target).is('a')) {

if (!$(this).find('> ul').is(':visible')) {
$(this).find('> ul').show();
$(this).find('> span.indicatordown').addClass('indicatorup');
$(this).find('> span.indicatordown').removeClass('indicatordown');
} else {
$(this).find('> ul').hide();
$(this).find('> span.indicatorup').addClass('indicatordown');
$(this).find('> span.indicatorup').removeClass('indicatorup');
}

return false;
}
});
});

CSS part

.primarycatslist{
width:250px;
}

.primarycatslist ul , .primarycatslist ul li{
margin:0;
padding:0;
list-style:none;
}

.primarycatslist ul li{
background: #afd0e7;
border-bottom: 2px solid #f1f8fd;
position: relative;
cursor:pointer;
}

.primarycatslist ul li a {
text-decoration: none;
color: #333;
padding: 7px 7px;
display:inline-block;
}

.primarycatslist ul li ul li.lisubfirst{
border-top: 2px solid #f1f8fd;
}

.primarycatslist ul li ul li.lisublast{
border-bottom:none;
}

.primarycatslist ul li ul li{
background:#c2dbed;
}

.primarycatslist ul li ul li a{
padding: 11px 21px;
}

.primarycatslist ul li ul li ul li{
background:#d7e9f6;
}

.primarycatslist ul li ul li ul li a{
padding: 11px 40px;
}

.coronaspan{
background:url(rss.png) no-repeat;
width:16px;
height:16px;
position:absolute;
right:11px;
top:11px;
display:inline-block;
}

.coronaspan a{
width:16px;
height:16px;
display:inline-block;
overflow:hidden;
cursor:pointer;
}

.indicatorup, .indicatordown{
width:16px;
height:16px;
position:absolute;
right:32px;
top:12px;
cursor:pointer;
background:url(arrow_top.png) no-repeat;
display:inline-block;
overflow:hidden;
}

.indicatordown{
background:url(arrow_bottom.png) no-repeat;
}

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jquery vertical accordion menu.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1.   Remove Yellow BGBOX WordPress plugin
  2.   Simple PHP Pagination Example Tutorial
  3.   Custom jQuery Validate Validation Example
  4.   ng-mouseenter Event using Angular Example
  5.   .htaccess Redirect old domain to new domain with URL match
  6.   Vue JS Axios Post Request using Laravel Example
  7.   Create Dynamic XML Sitemaps Using PHP MYSQL
  8.   Paytm Payment Gateway Integration in PHP step By step
  9.   Form Input Fields Validation using Angular Example
  10.   jQuery Add and Remove Multiple Div Dynamically using PHP