Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

jQuery accordion with google like summery

This is a follow on from This question

My accordion contains links within the header, when the link is clicked the accordion expanded contents is loaded via an ajax query
each header looks like this

 <h3><a id="1" href="index.html" >A html page</a></h3>

Open in new window


How do i display a summery when the accordion is collapsed  similar to how a google search is shown.

the code bellow breaks the accordion but this is what I'm trying to achieve

 <h3><a href="index.html" >A html page</a></h3>
      <p>Summery text Here</p>
     <div>Full page loaded here</div>
 <h3><a href="page.html" >Another html page</a></h3>
      <p>Summery text Here this is collapsed   </p>
     <div></div>
<!-- this fails as well-->
 <h3><href="index.html" >A html page <p>Summery text Here</p>
</a></h3>
     

Open in new window

0
trevor1940
Asked:
trevor1940
  • 2
  • 2
1 Solution
 
TvMptCommented:
Inside the event click use the .append

something like:
$('#the_a_id').append(' <p>Summary text Here this is collapsed</p>');
0
 
leakim971PluritechnicianCommented:
0
 
trevor1940Author Commented:
leakim971
click one
"page one" is shown
click two

"page two" is shown

but the summery for page one is now hidden &  the content remains.
shouldn't that be the other way around

eg the summaries are always visible but the content gets hidden!
0
 
leakim971PluritechnicianCommented:
What about this : http://jsfiddle.net/mBdYu/7/
0
 
trevor1940Author Commented:
Sweet!

Plugged it into previous code & worked a treat!
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now