PDA

View Full Version : Glossy accordion menu open automatically



ypadill2
04-27-2008, 06:59 PM
1) Script Title: Glossy accordion menu

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

3) Describe problem: I will like to have the menu open up imediatly when the page opens without having to click on the menu. I have two submenus and would like the first one to open up, I cant figure out what to do, I really appreciate all the help. :confused:

Medyman
04-27-2008, 07:17 PM
There is a defaultexpanded paramter in the ddaccordian.init function. You just need to set that.

Here is the example on the script's page. Notice the highlighted part.


ddaccordion.init({ //top level headers initialization
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"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isclicked){ //custom code to run whenever a header is opened or closed
//do nothing
}
})

ypadill2
04-27-2008, 08:43 PM
Yes I see that and I tried setting it to 0 and submenu this is for the glossy menu but nothing happens. The menu drops down in all the other pages once i have cliked one open. But it does not open automatically when the page is loaded to a new browser page. Thanks for the help.


my code looks like this



ddaccordion.init({
headerclass: "submenuheader", //Shared CSS class name of headers group
contentclass: "submenu", //Shared CSS class name of contents group
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
animatedefault:true, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["suffix","<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], //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"
ooninit:function(headers, expandedindices){ //custom code to run when headers have initalized
myiframe=window.frames["myiframe"] //reference and cache iframe to populate
var lastexpandedindex=expandedindices.pop() //get last index within array
myiframe.location.replace(headers[lastexpandedindex].getAttribute('title')) //load page associated with expanded header
},
onopenclose:function(header, index, state, isclicked){ //custom code to run whenever a header is opened or closed
if (state=="block" && isclicked==true){ //if header is expanded and as the result of the user clicking on it
myiframe.location.replace(header.getAttribute('title'))
}
}
})

ypadill2
04-27-2008, 09:03 PM
Im sorry I need to be more specific, well it works in IE but not in Firefox when i set it to 0.

ddadmin
04-28-2008, 07:23 AM
Hmmm I'll need to see the problem pagePlease post a link to the page on your site that contains the problematic script so we can check it out.

ypadill2
04-29-2008, 05:17 PM
https://netfiles.uiuc.edu/ypadill2/www/aboutus.html

thanks for your help

ddadmin
04-30-2008, 07:58 AM
Try upgrading to the latest version of ddaccordion.js Just go to the script page (http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm)and replace your current .js file with the most recent ddaccordion.js That should fix the default open issue in FF.

ypadill2
05-01-2008, 07:40 PM
I did that, i replaced the js file but it still does not want to expand automatically in firefox, Do i need to set the defaultexpanded: [] to something else besides 0 in order for it to work?