PDA

View Full Version : How do i load a page with a particular accordian section open as a default?



logicSix
03-12-2008, 11:06 PM
1) Script Title: ddaccordion

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

3) Describe problem:

if I click on a link in one particular block that goes to another page in that same block, it will not keep that block open on page load, but instead it will open up the last one i was in. How do i designate which block to have open by default on each page?

for instance,

on pages 1-4 i want block 1 to open by default. for pages 2-8 i want block 2 to be open by default.

any help would be great.

ddadmin
03-13-2008, 08:35 AM
The parameter:


defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.

within the initialization code in the HEAD dicates which headers should be expanded by default. So on the 1st-4th page, you'd have:


defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.

while the others, something like:


defaultexpanded: [1], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.

Note that if you have persistence enabled, you'll want to close the browser and reopen it to see the default expanded feature actually kick in.

logicSix
03-14-2008, 02:41 AM
ok, i will give it a shot and let you know...

logicSix
03-15-2008, 12:52 AM
i cannot to get it to work. here is my 'navigation'


<div class="arrowlistmenu">
<h3 class="menuheader" style="cursor: default"><a href="../index.php">Home</a></h3>
<h3 class="menuheader expandable">For Birth Parents </h3>
<ul class="categoryitems">
<li><a href="../birth_parents/options.php">What Are My Options?</a></li>
<li><a href="../birth_parents/who.php">Who's Going to Adopt My Baby? </a></li>
<li><a href="../birth_parents/what.php">What's Going to Happen To Us? </a></li>
<li><a href="../birth_parents/dad.php">What About the Dad? </a></li>
<li><a href="../birth_parents/next.php">What's The Next Step?</a></li>
<li><a href="../birth_parents/help.php">Where Can I Turn for Help?</a></li>
</ul>
<h3 class="menuheader expandable">For Adoptive Parents </h3>
<ul class="categoryitems">
<li><a href="../adoptive_parents/options.php">What Are My Options?</a></li>
<li><a href="../adoptive_parents/who.php">Who Put Their Baby up for Adoption?</a></li>
<li><a href="../adoptive_parents/process.php">How Does The Process Work? </a></li>
<li><a href="../adoptive_parents/how.php">Cost &amp; Length of Time </a></li>
<li><a href="../adoptive_parents/what.php">What Do I Need To Do? </a></li>
<li><a href="../adoptive_parents/what_else.php?f=6">What Else Should I Know? </a></li>
</ul>
<h3 class="menuheader expandable">For Adoptees </h3>
<ul class="categoryitems">
<li><a href="../adoptees/index.php">The Search Effects </a></li>
<li><a href="../adoptees/effect.php">The Effect</a></li>
<li><a href="../adoptees/reunion.php">The Reunion</a></li>
<li><a href="../adoptees/resources.php">Resources</a></li>
</ul>
<h3 class="menuheader" style="cursor: default"><a href="../professionals/index.php">For Professionals</a></h3>
<h3 class="menuheader expandable">About Us </h3>
<ul class="categoryitems">
<li><a href="../about/who.php">Who Are We? </a></li>
<li><a href="../about/why.php">Why Did We Start FFTA? </a></li>
<li><a href="../about/board.php">Our Advisory Board </a></li>
</ul>
<h3 class="menuheader expandable">That Says It All</h3>
<ul class="categoryitems">
<li><a href="../testimonials/words.php">In Words</a></li>
<li><a href="../testimonials/pictures.php">In Pictures</a></li>
</ul>
<h3 class="menuheader" style="cursor: default"><a href="index.php">How Can We Help? </a></h3>
</div>

is there anything i need to change? i have it looking and opening/closing the way i want but i cannot seem to have one area open on default. What can be done to fix this?

bradymc
03-16-2008, 03:33 AM
Did you change what DDAdmin asked you to change? Post your initialization code from the <head> of your document as well so we can see what you've done there.

logicSix
03-16-2008, 04:56 PM
i changed the default expanded to '0' to keep the first one open. did i screw it up...?



ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
})

bradymc
03-16-2008, 07:02 PM
Looks good to me. Do you have a link that you can share regarding these pages?

logicSix
03-20-2008, 02:05 AM
brady

here: http://development.fluidred.com/ffta/

the user is devel, password is password. i will keep it like this for 2 days

bradymc
03-20-2008, 03:16 AM
Here's one problem... you have the same initialization code on EVERY page.

You have this:

ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
})
... notice the code in red. That is telling every page to open, by default, the first expandable section.

If you want all the pages under "For Adoptive Parents" to be expanded by default, you should change the code in red above to be:

defaultexpanded: [1],

If you want all the pages under "For Adoptees" to be expanded by default, you should change the code in red above to be:

defaultexpanded: [2],

etc., etc.

And I'm guessing here, but I think that you need to turn off the persistence state.

persiststate: false,
Try the first part and see what happens. If it's still not quite right, try to turn off the persistence.

logicSix
03-20-2008, 01:56 PM
i will give this a shot and see what happens. Thanks a bunch

logicSix
03-26-2008, 01:37 PM
Here's one problem... you have the same initialization code on EVERY page.

You have this:

ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
})
... notice the code in red. That is telling every page to open, by default, the first expandable section.

If you want all the pages under "For Adoptive Parents" to be expanded by default, you should change the code in red above to be:

defaultexpanded: [1],

If you want all the pages under "For Adoptees" to be expanded by default, you should change the code in red above to be:

defaultexpanded: [2],

etc., etc.

And I'm guessing here, but I think that you need to turn off the persistence state.

persiststate: false,
Try the first part and see what happens. If it's still not quite right, try to turn off the persistence.

ok, it's working 'better', however the option I want open will not stay open if i was in another area previously. For instance, 2 will not open when i click on a link in 2 unless i was on a previous link in 2. It will still keep the previous area open.

Turning off persistance just kept all closed on each page change which is not ideal for me, but an option. Any ideas? this is frustrating.