Accordion is a very useful feature when you need to put large amount of content into small area in website. jQuery come up with built-in jquery accordion feature but if you want to add jquery accordion feature into your website you have to download jquery UI having size of around 25KB.
In this tutorial I am going to create simple jquery text accordion stay with me.
Steps to follow
Create HTML
Write Css
Add jQuery
Step 1: Create HTML
XHTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<div class="container">
<ul id="simple-accordion">
<li>Click here to show text 1 <span>+</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</li>
<li>Click here to show text 2 <span>+</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</li>
<li>Click here to show text 3 <span>+</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</li>
<li>Click here to show text 4 <span>+</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
I am a web developer and love to search new stuff on web. Trying different approaches and ideas to make web developing more interesting and enjoyable.
View all posts by Ahsan Zameer
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok