css smooth accordion dropdown with jquery

How we can create an accordion with smooth items reveal effect? Solution: Check out this CSS Smooth Accordion Dropdown With jQuery, Smooth Sub Items Reveal.

Previously I have shared some accordion programs, but this program is with smooth item reveal or dropdown feature. Basically, accordion is the Show/Hide operation of a box region but extended to have multiple sections in a list. Suppose we have to put a list with some items and their sub-items in less space, then you use an accordion to manage those.

Today you will learn to create an accordion with smooth sub items reveal effect. Basically, there are 4 items in accordion with an icon and 3 sub-items inside of each. When you will click on any menu item, then sub-menu items will reveal with an up to down expanding smooth animation. Also, there is an arrow down icon for indicating hidden items, it will rotate to up after revealing items.

So, Today I am sharing CSS Smooth Accordion Dropdown With jQuery. There I have used HTML and CSS for creating and styling the layout and the functions are based on jQuery. As we know jQuery is a JS library that’s why I am putting this post in the JavaScript category. You can use this accordion on your website, this is a complete program.

If you are thinking now how this smooth accordion actually is, then see the preview given below.

Preview Of Smooth Sub Items Reveal Animation

See this video preview to getting an idea of how the reveal animation and complete accordion looks like.

Live Demo

Now you can see this visually, also you can see it live by pressing the button given above. If you like this, then get the source code of its.

You May Also Like:

CSS Smooth Accordion Dropdown With jQuery Source Code

Before sharing source code, let’s talk about it. First I have created the layout using HTML list <ul> & <li> tags. Inside the main section, there are 4 different sections, I have created a div for menu name and placing icon. Inside each div, I have again placed list tags for showing sub-menu items. There I have used font awesome library for placing the icons.

Now using CSS I have placed all the elements in the right place, as you can see in the preview. With CSS, I have done basic works like size, position, margin, padding, etc. For rotating the down arrow to up used CSS transform: rotate(); command and used transition for smooth reveal animation.

jQuery handling here some important features of this program. Features like toggle, put the CSS animation on reveal, and close left other items on opening any item. Basically, jQuery adding and removing the CSS class according to user action. Left all other things you will understand after getting the codes, I can’t explain all in writing.

To Creating this program you have to create 3 files. First for HTML, second for CSS, and the third for JavaScript. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

function.js

The final step, create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created CSS Smooth Accordion Dropdown With jQuery, Smooth Sub Items Reveal Animation. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

LEAVE A REPLY

Please enter your comment!
Please enter your name here