Using tables with Accordion widget
Hi there,
I'm fairly new to jQuery and jQuery UI, and I would like to implement the accordion widget on one of my sites.
I have used the example published on jqueryui.com and it works fantastically. However, I would like to use a table within each section of the accordion, and if I try, the accordion breaks.
Below is an example of my code:
- <head>
- <link type="text/css" href="css/custom-theme/jquery-ui-1.8.custom.css" rel="stylesheet" />
- <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.custom.min.js"></script>
- <script type="text/javascript">
- $(function(){
- $("#accordion").accordion({ header: "h3", autoHeight: false, navigation: true });
- });
- </script>
- <style type="text/css">
- .demoHeaders { margin-top: 2em; }
- #dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
- #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
- ul#icons {margin: 0; padding: 0;}
- ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;}
- ul#icons span.ui-icon {float: left; margin: 0 4px;}
- </style>
- </head>
- <body>
- <div id="accordion">
- <div>
- <h3><a href=\"#\">Section 1 Title</a></h3>
- <div>
- <table>
- <tr>
- <td>Col1</td>
- <td>Col2</td>
- <td>Col3</td>
- </tr>
- </table>
- </div>
- </div>
- <div>
- <h3><a href=\"#\">Section 2 Title</a></h3>
- <div>
- <table>
- <tr>
- <td>Col1</td>
- <td>Col2</td>
- <td>Col3</td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- </body>
Am I able to use jQuery UI to have tables within this animated accordion?
Your assistance is greatly appreciated.
Regards,
Chris.