Solved

jQuery accordion with google like summery

Posted on 2013-05-31
5
299 Views
Last Modified: 2013-05-31
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
Comment
Question by:trevor1940
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:TvMpt
ID: 39210279
Inside the event click use the .append

something like:
$('#the_a_id').append(' <p>Summary text Here this is collapsed</p>');
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39210719
0
 
LVL 1

Author Comment

by:trevor1940
ID: 39211010
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
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39211143
What about this : http://jsfiddle.net/mBdYu/7/
0
 
LVL 1

Author Closing Comment

by:trevor1940
ID: 39211422
Sweet!

Plugged it into previous code & worked a treat!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now