Ajax Loader
HTML
<div class="accordion">
1
<div class="accordion">
2
  <div class="accordion-item">
3
    Item 1
4
    <div class="type"></div>
5
  </div>
6
  <div class="data">
7
   Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
8
  </div>
9
   <div class="accordion-item">
10
    Item 2
11
     <div class="type"></div>
12
  </div>
13
  <div class="data">
14
    when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
15
  </div>
16
  <div class="accordion-item">
17
    Item 3
18
    <div class="type"></div>
19
  </div>
20
  <div class="data">
21
   Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
22
  </div>
23
</div>
24
 
25
<script class="cssdeck" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
 
CSS
body
1
body
2
{
3
font-family: Arial, Helvetica, sans-serif;
4
}
5
.accordion
6
{
7
  width:100%;
8
  min-height:300px;
9
  margin:20px auto;
10
}
11
.accordion-item {
12
font-size: 1em;
13
margin: 0 10px 0 10px;
14
padding: 10px;
15
height: 20px;
16
background: #f2f2f2;
17
border-bottom:1px solid #ccc;
18
color: #000;
19
cursor:pointer;
20
}
21
 
22
.accordion-item.open
23
{
24
background:#14ad40;
25
border-bottom:0px;
26
color:#fff;
27
}
28
.accordion-item.open .type {
29
float: right;
30
background: url('http://vivekarora.com/images/minus.png') center no-repeat;
31
padding: 10px;
32
}
33
 
34
.accordion-item .type {
35
float: right;
36
background: url('http://vivekarora.com/images/plus.png') center no-repeat;
37
padding: 10px;
38
}
39
 
40
div.data {
41
background: #fff;
42
margin: 0 10px 0 10px;
43
padding: 10px;
44
border:1px solid #ccc;
45
font-size: .8em;
46
line-height: 140%;
47
display:none;
48
}
 
JavaScript
$(function($) {
1
$(function($) {
2
  var allAccordions = $('.accordion div.data');
3
  var allAccordionItems = $('.accordion .accordion-item');
4
  $('.accordion > .accordion-item').click(function() {
5
    if($(this).hasClass('open'))
6
    {
7
      $(this).removeClass('open');
8
      $(this).next().slideUp("slow");
9
    }
10
    else
11
    {
12
    allAccordions.slideUp("slow");
13
    allAccordionItems.removeClass('open');
14
    $(this).addClass('open');
15
    $(this).next().slideDown("slow");
16
    return false;
17
    }
18
  });
19
});
 

Simple jQuery Accordion

CSSDeck G+