473,378 Members | 1,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

JQuery accordion script?

36
Hi Guys

Does anyone know of any simple/basic jquery vertical accordion scripts that allow me to place a html table in the info section (ie the window that pulls down and displays the hidden content)?

I have found loads of examples of accordion scripts out there but none allow me to show and hide a simple html <table>.

My current JQuery UI accordion script only allows me to put in text within <p> tags. I have tried replacing the <p> tabgs with <table> tags but this still didn't work.

My accordion script works fine when I have info between <p> tags. However, if I add a <table> element inside the <p> tags (or instead of them) then when you load the page the table is not hidden and it's also not possible to hide it when clicking the "Menu" link. My code can be seen here:

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. .accordion2 {
  3. width: 100%;
  4.  
  5. }
  6. .accordion2 h2 {
  7. color:#0066CC;
  8. text-decoration: underline;
  9. padding: 4px 0px;
  10. margin: 0;
  11. cursor: pointer;
  12. font-size:9pt;
  13. }
  14. .accordion2 h2:hover {
  15.  
  16. }
  17. .accordion2 h2.active {
  18. background-position: right 50px;
  19. }
  20. .accordion2 p {
  21. margin: 0;
  22. padding: 5px 5px 5px;
  23. display: none;
  24. }
  25. </style>
  26.  
  27. <script type="text/javascript"> 
  28. $(document).ready(function(){ 
  29.  
  30. $(".accordion2 h2").eq().addClass("active"); 
  31. $(".accordion2 p").eq().show(); 
  32.  
  33. $(".accordion2 h2").click(function(){ 
  34. $(this).next("p").slideToggle("slow") 
  35. .siblings("p:visible").slideUp("slow"); 
  36. $(this).toggleClass("active"); 
  37. $(this).siblings("h2").removeClass("active"); 
  38. }); 
  39.  
  40. }); 
  41. </script>
  42.  
  43. <div class="accordion2"> 
  44. <h2 class='listing_acc'>Menu 1<h2> 
  45. <p>Menu 1 info</p> 
  46. </div>
  47.  
Any ideas? Any help would be fully appreciated.

Best regards

Rod from the UK
Feb 24 '10 #1
0 2113

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Darrel | last post by:
I'd like to use the jquery datepicker. I have a asp.net 1.1 application set up with forms authentication protecting an admin directory: <location path="admin"> <system.web> <authorization>...
1
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
2
by: LayneMitch via WebmasterKB.com | last post by:
Greetings. I'm reading this book that is teaching me the more appropriate way of assigning functions. It has an 'accordian' example that when you click on a link, it expands into other options...
8
by: Tomasz J | last post by:
Hello developers, After migrating my web project application (using the old model) to .Net Framework 3.5 and Ajax Control Toolkit release 20820 the Accordion control no longer works correctly....
2
by: souporpower | last post by:
Hi All I am trying to print some HTML using JQUERY. I am posting the code. I don't see the alert. It seems as though the function is not registered when the document is loaded. Can someone...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
3
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first...
3
by: empiresolutions | last post by:
http://cesarvillaca.com/temp/accordion_top_scroll/ I'm using the MooTools v1.2 Accordion script. I have an issue with my accordion data not scrolling properly. If you go to the link posted above...
8
by: quipo | last post by:
Hi, im using an accordion script but it doesnt work if i use it with ajax. example: <div id="accordion"> <dl class="accordion" id="slider"> <dt>click here for the 1st pane</dt> ...
25
pradeepjain
by: pradeepjain | last post by:
<html> <head> <script src="jquery.js" type="text/javascript"></script> <script src="jquery.rating.js" type="text/javascript" language="javascript"></script> <link...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.