PDA

View Full Version : Accordion Content - Number Of 'Pets'?



MattyBumBum
07-08-2008, 12:19 AM
Accordion Content 1.5.1

http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

Is the ddaccordion.expandone function really limited to 5 headers? Because I want 30.



ie: I can only get this to work for values of "X" of 0-4

<a href="#" onClick="ddaccordion.expandone('mypets', X); return false" class="bodylink">

ddadmin
07-08-2008, 01:09 AM
There's no limit to the number of contents you can have in an Accordion Content instance. Please post a link to the page on your site that contains the problematic script so we can check it out.

MattyBumBum
07-08-2008, 11:26 AM
Oh, OK.


http://mjrcreative.com/als/faq.htm


(Please note: I've removed Example 2 entirely and placed the init in its own external file, Templates/ddaccordionbit.js)


Ah, I see now I've uploaded it NONE of them work...

Ah, OK, if I set up 15, only the first 5 work - if I set up 20, none work - if I set up 10, 10 work - or something...?

MattyBumBum
07-09-2008, 12:31 AM
Nothing yet chaps? Have I accidentally committed a no-no, or merely confused the issue?

ddadmin
07-09-2008, 05:28 AM
A couple of implementation errors I see, looking at your source. Firstly, a lot of your headers/content pair look like the following:


<b><a href="#" onClick="ddaccordion.expandone('mypets', 01); return false" class="bodylink">How
long does the carpet cleaning process take?</a></b>
<div class="thepet"> We are able to clean approximately 200 square
feet per hour. This can vary slightly depending upon the amount
of soil, how much furniture needs to be moved, specialty spotting
procedures, and set-up time. </div>

The 2nd parameter within ddaccordion.expandone('mypets', 01) should be a straight integer, not prefixed with "0". Secondly, what you have with the above HTML chunk are accordion contents (with CSS class "thepet"), but no corresponding header (with CSS class "mypets"). This is problematic in that you have now more accordion contents on the page total than you have headers. You should always have an equal number of the two on the page. That's not to say you can't have arbitrary links on the page that expand a particular accordion content, but in that case, you shouldn't be adding an accordion content beneath that arbitrary link as you have now.

MattyBumBum
07-09-2008, 10:23 AM
Aha! Thank you very much. As you can see, I have used your answer to force my result in perhaps the least elegant way possible, ie: by simply adding <span class="mypets"> </span> to the end of each of my anchors. I think I can hear you turning in your grave, but thanks again!