I’m using the accordion code found on this site. My version of the code is only slightly changed, but I’m seeing a few differences in how my accordion acts, versus his.
-
I’m not able to both open and close a pane by clicking its header. (Works in his code, not in mine)
-
I’m not able to have the first pane opened by default. (works in his code, not in mine)
-
I’d like to set the second of two panes to be opened by default. (new)
Here’s my code. “Search” is not a pane, it will always be visible. The content under “Tools” and “Member Info” is the bits in an accordion, and Tools and Member Info are the clickable headers.
In my code, I changed the sections to divs, and when I run the code through Firebug, I get an error that says
$('.accordion-item').eq(1).addClass('current').find('.content').show();
But I’m not sure why it’s not defined. I changed the element, I didn’t remove the accordion-item class. jQuery is listed in the header, and it’s the only JavaScript file referenced in the header:
<script type="text/javascript" src="./js/jquery-1.8.2.js"></script>
How do I modify the code to get it to work like his; and how can I modify the code to add in the functionality that I want (point the third)?
Never mind, I found it. I had jquery’s file name misspelled: was jquery-1.8.2.js, should have been jquery-1.8.2.min.js. Always…never…forget to check your references.