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.

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

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

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

Another must read:  Laravel 6 Remove public from URL

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.

Another must read:  How to display break in Laravel blade properly?

Leave a Reply

Your email address will not be published. Required fields are marked *